【发布时间】:2021-02-11 11:30:37
【问题描述】:
我需要在一个存储过程中执行几个 select 语句,然后在过程结束时根据在 select 语句中检索到的键来更新表。在存储过程中执行此操作的最佳方法是什么,我查看了全局临时表,但这似乎不是最好的方法。
仅供参考,对于选择语句,我在循环中使用游标,这就是我希望更新本地临时缓存/表的方式。
提前感谢您的帮助。
create or replace procedure...
begin
select primary_keys from table..
-- save these keys to a temp cache or table
select primary_keys from table
-- save these additional keys to a temp cache or table
update table set field = 1 where primary_key in (select keys in temp cache or table)
commit;
delete temp cache or table
【问题讨论】:
-
您使用的是哪个版本的 Oracle?
标签: sql oracle stored-procedures plsql