存储过程及游标使用
实现test2表向test1表同步
create or replace procedure procedure_test as
v_id armcp.test2.id%Type;
v_c1 armcp.test2.c1%Type;
cursor cursor_test2 is(
select t2.id, t2.c1 from test2 t2);
begin
open cursor_test2;
loop
fetch cursor_test2
into v_id, v_c1;
update test1 t1 set t1.c1 = v_c1 where t1.id = v_id;
exit when cursor_test2%notfound;
end loop;
commit;
close cursor_test2;
end;
来源:https://www.cnblogs.com/BonnieWss/p/10910944.html