declare
cursor c_cursor is
select * from table_1
for update of col_1;
v_col varchar2(5);
begin
for v_cursor in c_cursor
loop
begin
select col_3 into v_col
from table_2
where table_2.col_2=table_1.col_2;
exception
col_1 ;='NO';
end;
--if SQL%FOUND then
update table_1
set col_1=v_col
where current of c_cursor;
--else
--update table_1
--set col_1='NO'
--where current of c_cursor;
--end if;
end loop;
end;
cursor c_cursor is
select * from table_1
for update of col_1;
v_col varchar2(5);
begin
for v_cursor in c_cursor
loop
begin
select col_3 into v_col
from table_2
where table_2.col_2=table_1.col_2;
exception
col_1 ;='NO';
end;
--if SQL%FOUND then
update table_1
set col_1=v_col
where current of c_cursor;
--else
--update table_1
--set col_1='NO'
--where current of c_cursor;
--end if;
end loop;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货