???? ??????п?????洢???????????????д????????Щ???????????????????????? ?ó?????????£?????ù??????????????????????????????????????????OK
???????????2?????
??????temp1??????id1??val1??2????Σ?
??????temp2??????id2??val2 2????Ρ?
????????????????????????2?????ID???й?????????temp2?а?????temp1??id?????????temp1?а?val1???????1???????????????0.
?????????????????????洢?????

 

create or replace procedure mysdtest
as
cursor te_v1 is
select id1??val1 from Temp1;
cursor te_v2 is
select id2??val2 from Temp2;
v1_t te_v1%rowtype;
v2_t te_v2%rowtype;
begin
open te_v1;
loop
fetch te_v1 into v1_t;
exit when te_v1%notfound;
open te_v2;
loop
fetch te_v2 into v2_t;
exit when te_v2%notfound;
if v1_t.id1=v2_t.id2
then update temp1 set val1='1' where id1=v1_t.id1;
else
update temp1 set val1='0' where id1=v1_t.id1;
end if;
end loop;
close te_v2;
end loop;
close te_v1;
end;

????????д??????????????2?????????????????0?????????3??????????
??????????????? t1 ???temp1?????????????val1?1????????????????t2??????t1?????????????else ???t1??val1??????0???????????????????????else??????????????