下面例子中A表是数据源,B表是插入数据目标。
create or replace procedure ... ...
cursor c1 is select * from A where... ...for update of 需要更新的列;
v c1%rowtype;
begin
open c1;
loop
fetch c1 into v;
exit when c1%notfound;
insert into B... ...;
update A set 需要更新列=... ... where current of c1;
... ...
end loop;
... ...
end;
更新数据来源库?是和你当前运行存储过程不在同一个库吗?
还是要,更新源数据表的?