表A
ID WEB_URL
----- ----------
001
002
003
表B
ID WEB_URL
----- ----------
001 aa
002 bb
003 cc
004 dd
根据表B的WEB_URL列更新表A的WEB_URL
create or replace procedure wjb_pk
is
v_web_url tab_a.web_url%type;
v_id tab_b.id%type;
---------------------声明变量
cursor c1 is select tab_a.id newid,tab_b.web_url from tab_a,tab_b
where tab_a.id=tab_b.id;
---------------------创建游标
begin
open c1;---------------开启游标
loop
fetch c1 into v_id,v_web_url;-----------------赋值
UPDATE tab_a SET web_url=v_web_url where id = v_id;
exit when c1%notfound;
end loop;
close c1;
end;
/