Avoid use of cursor?
Hi all,
I've a procedure that should run:
SELECT DATA
INTO MYDATA
FROM SCHEMA.TABLE ;
Schema should be result of a concatenated string SCHEMA+VAR (where var is the first parameter of my procedure). To do this I have to use a
MYQUERY := 'SELECT DATA INTO MYDATA FROM SCHEMA'||VAR||'.TABLE ;'
dbms_output.put_line(MYQUERY);
begin
execute immediate MYQUERY
end
Execute immediate is not compatible with a construct similar to SELECT SOMETHING INTO ANOTHERTHING and to resolve this I should use a cursor.
Is not clear if I can avoid the use of a cursor to do this simple thing or I have to create a cursor for each of my statement in procedure like this one (7 statements) and so create,manage,destroy 7 cursors.
Any hints?
thanks
Ste