oracle 临时表操作

r_x_y r_x_y 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
步骤一:建立临时表
create global temporary table t_temp
(COL varchar2(30))
on commit preserve rows;

执行该语句;

步骤二:建procedure(在包体里面,定义就不写了),调用若满足function check_st_cursor_status,则给临时表赋值
procedure init_temp_table as
cursor st_cursor is
select * from st_table;
begin
for cur in st_cursor loop
if (check_st_cursor_status(cur.stid)) then
insert into t_temp (COL) values (cur.stid);
commit;
end if;
end loop;

EXCEPTION
when others THEN
dbms_output.put_line(Sqlerrm);
rollback;
end init_temp_table;

步骤三:
通过调用function,返回临时表里的数据集

在执行到加红语句时,cur.stid确实有值,可是,读临时表,里面却没有数据???
请大家帮忙,如何在临时表里赋值。

我的分比较少,不好意思。
谢谢:)
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
r_x_y
Oracle 17,134 成员 55,258 内容