我想在一个不存在的表上声明一个游标。当然,我的程序没有编译。
该表是临时表,由预处理创建。它将存在于运行时,但在编译时是另一回事。
对于我的选择/更新其他 DML 操作,我使用过
EXECUTE IMMEDIATE 'operation from tmp_table'
但我找不到游标的解决方法。
有办法吗?
基本上,我希望这个编译
drop table test;
/*from this on should compile*/
DECLARE
cursor c is select * from test;
BEGIN
for reg in c LOOP
/*...*/
END LOOP;
END;
更新
到目前为止没有编译:
SQL> declare
2 c sys_refcursor;
3 BEGIN
4 open c for 'select * from pepito'; -- 'pepito' does not exist
5 close c;
6 end;
7 /
declare
*
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at line 4
应该使用 CREATE PROCEDURE,谢谢。
提前致谢。