Dynamic sql in cursor or if stmt or for loop
709382Jul 30 2009 — edited Jul 30 2009Hi
I am not able to use dynamic sql in cursors or if statements or for loops.Is there any way for this.
For example
create procedure test_1 as
v_username varchar(40);
v_sql_ac varchar2(50) ;
begin
v_sql_ac := 'select * from dbaoper.t_system_users';
v_username := 'TEST' ;
if v_username not in (execute immediate v_sql_ac) then
dbms_output.put_line (' HI' );
else
dbms_output.put_line ('Bye');
end if;
end;
/
LINE/COL ERROR
-------- -----------------------------------------------------------------
7/31 PLS-00103: Encountered the symbol "IMMEDIATE" when expecting one
of the following:
. ( ) , * @ % & | = - + < / > at in is mod remainder not
range rem => .. <an exponent (**)> <> or != or ~= >= <= <>
and or like LIKE2_ LIKE4_ LIKEC_ between || multiset member
SUBMULTISET_
The symbol ". was inserted before "IMMEDIATE" to continue.
Thanks in Advance
PRamod