更新时间:2023-11-17 17:33:16
您只能使用一个loop
语句和variables
(v_address
和v_aid
)在行之间进行比较,如下所示:在下面的块中:
You can use only one loop
statement and variables
( v_address
and v_aid
) to make a comparison between the rows as in the block below :
declare
v_address address.address%type;
v_aid address.aid%type;
begin
for i in (select aid ,address from address order by aid)
loop
if nvl(v_address,'')=i.address then
update employee_add set aid=v_aid where aid=i.aid;
delete address where aid=i.aid;
else
v_address := i.address;
v_aid := i.aid;
end if;
end loop;
end;