?????????д????????????????????????????α????????2???α????????????б??????????????
???????£?

 

create or replace procedure myt
as
cursor te_v1 is
select id1??val1 from Temp1;
cursor te_v2(idv2 varchar2) is
select count(*) from temp2 where id2=idv2;
v1_t te_v1%rowtype;
numv varchar2(2);
begin
open te_v1;
loop
fetch te_v1 into v1_t;
exit when te_v1%notfound;
open te_v2(v1_t.id1);
fetch te_v2 into numv;
if numv=0
then
update TEMP1 set val1='0' where id1=v1_t.id1;
else
update TEMP1 set val1='1' where id1=v1_t.id1;
end if;
close te_v2;
end loop;
close te_v1;
end;

????ok????????????????????