Long Sql used for Ref Cursor - Getting Invalid Identifier error [message #277800] |
Wed, 31 October 2007 12:32 |
tots
Messages: 2 Registered: August 2000
|
Junior Member |
|
|
I am trying to send a long sql to a ref cursor, but I am getting Invalid Identifier error.
The reason for passing a dynamic sql is that depending on a condition i am changing the where clause in the sql statement
l_query1 := 'SELECT distinct ' || l_study_no || ' ,a.BASELINE_NUMBER,a.ALLOCATION_NUMBER,a.AGE, a.GENDER
FROM TBL1 a inner join TBL2 b ON a.product_name = ''' || p_prod_nm || ''')'
if UPPER(substr(p_sc, 1)) = 'V' then
l_query1 := l_query1 || ' OR NVL(A.hos, ''L'') != NVL(B.hos, ''K''))' ;
else
l_query1 := l_query1 || ' OR NVL(A.cos, ''L'') != NVL(B.cos,''K''))' ;
end if;
Open cur for l_query1
Loop
Fetch cur in currec;
Please help me out withis and let me know if you need some more inputs.
|
|
|
|
|
|
|
|
|
|
|