I have one question about "EXECUTE IMMEDIATE". I dynamically changed the table name in the following plsql expression
DECLARE TYPE CurTyp IS REF CURSOR; cur CurTyp; str1 VARCHAR2(30); str2 VARCHAR2(30); table_name VARCHAR2(30); BEGIN select data into table_name from ref where o_id = 111 and a_id = 222; OPEN cur FOR 'select name, sname from :1 b,myobjects a where a.obj_id = b.obj_id' USING table_name; LOOP FETCH cur INTO str1, str2; EXIT WHEN cur%NOTFOUND; dbms_output.put_line(str1||str2); END LOOP; CLOSE cur; END
Is it possible to read the result of the following Execute Immediate query before the cursor?
'select name, sname from :1 b,myobjects a where a.obj_id = b.obj_id' USING table_name;
Or maybe there is a way to do this?
Thanks in advance.
source share