order by in a function [message #171201] |
Tue, 09 May 2006 00:45 |
indraneelkumar
Messages: 24 Registered: September 2005 Location: bangalore
|
Junior Member |
|
|
Hi
In Reports In Formula column I am writing a cursor(pl/sql formula) when I am compailing it gives an error as "encountered symbol "ORDER" when expecting one of following"
If I comment the order by caluse working properly
I executed same cursor in back end it working properly
Why it is giving error in reports
plz help me
SELECT * FROM (
SELECT MAX(PEMPH_END_NO_IDX),POLH_SYS_ID,PEMPH_SPOUSE_YN, PEMPH_CHILD_YN
FROM PH_GL_POLICY,PH_GL_POL_EMPLOYEE
WHERE POLH_SYS_ID = PEMPH_POL_SYS_ID
AND NVL(POLH_MASTER_POLICY_NO,0) BETWEEN :P_FM_MAST_POL_NO AND :P_TO_MAST_POL_NO
AND POLH_NO BETWEEN :P_FM_POL_NO AND :P_TO_POL_NO
AND POLH_NO NOT IN (SELECT POLH_NO
FROM PH_GL_POLICY B
WHERE B.POLH_SYS_ID = POLH_SYS_ID
AND B.POLH_STATUS = 'C'
AND :P_AS_OF_DT >= B.POLH_END_EFF_FM_DT)
AND PEMPH_SYS_ID NOT IN (SELECT PEMPH_SYS_ID
FROM PH_GL_POL_EMPLOYEE E
WHERE E.PEMPH_SYS_ID = PEMPH_SYS_ID
AND E.PEMPH_POL_SYS_ID = POLH_SYS_ID
AND :P_AS_OF_DT >= E.PEMPH_EXIT_DT)
AND PEMPH_ID = :Q1_PEMPH_ID1
AND :P_AS_OF_DT BETWEEN POLH_FM_DT AND POLH_TO_DT
GROUP BY POLH_SYS_ID,PEMPH_SPOUSE_YN, PEMPH_CHILD_YN
ORDER BY PEMPH_SPOUSE_YN DESC,PEMPH_CHILD_YN DESC )
WHERE ROWNUM =1 ;
Thanks in advance
|
|
|
|
Re: order by in a function [message #172025 is a reply to message #171772] |
Sat, 13 May 2006 05:38 |
hanon_ocp
Messages: 4 Registered: May 2006 Location: Egypt
|
Junior Member |
|
|
Dear indraneelkumar
if ur query works just fine on sql plus then
this problem can be due to the difference between the pl/sql engine used in reports
and the engine used in the server
i had asimiliar situition before
where he objected on the order by clause in the report while it is working fine as sql statment
SOULTION :
Try to make your formula on database
as database function
and just calling it from report passing the appropriate parameters.
please feed me back
note :
Dear Littlefoot
the sql statment is not a select statment whiche requir into clause
it is a cursor only
defined in the declare section of formula
thanx
urs Eng.Hany
[Updated on: Sat, 13 May 2006 05:39] Report message to a moderator
|
|
|
|