注册

存储过程含有游标的临时表怎么使用

fang 2023/08/28 1009 1

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:
【操作系统】:
【CPU】:
【问题描述】*:

create or replace procedure tmpc2 ()
as
v_num int;
c cursor for select id from tmp2;
begin
execute immediate 'drop table if exists tmp2';
execute immediate 'create temporary table tmp2( id int,name varchar(200))';
open c;
fetch c into v_num;
while c %found loop
print v_num;
fetch c into v_num;
end loop;
close c;
execute immediate 'drop table tmp2';
end;
编译报错,提示无效的表和视图
image.png
直接手工创建临时表
create temporary table tmp2( id int,name varchar(200));
可以正常编译存储过程
image.png
但无法调用
image.png

回答 0
暂无回答
扫一扫
联系客服