我有一个关于“EXECUTE IMMEDIATE”的问题。
我在下一个PLSQL语句中动态地更改了表名。
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
能否将下一个Execute Immediate查询的结果读取到游标中?
'select name, sname from :1 b,myobjects a where a.obj_id = b.obj_id'
USING table_name;
也许有什么方法可以做到这一点吗?
提前感谢。