宣布开始 为我(选择援助,地址) 环 for j in(select aid,address from address) 环 如果i.address = j.address那么 如果i.aid!= j.aid然后 …
你只能使用一个 loop 声明和 variables ( v_address 和 v_aid )在下面的块中进行行之间的比较:
loop
variables
v_address
v_aid
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;