You are on page 1of 1

Table aa1 with two columns id ,sal.

--(in the beginning stage) ID SAL ------ ---------1 100 2 200 3 300 4 100 5 400 5 600 7 800 After executing this procedure it alternate two columns data create or replace procedure aa2 as v_no1 number; cursor mycursor is select id,sal from aa1; begin for i in mycursor loop --dbms_output.put_line(i.id||' '||i.sal); v_no1:=i.id; -- dbms_output.put_line(v_no1); update aa1 set id=i.sal, sal=v_no1 where id=i.id; end loop; commit; end; exec aa2; select * from aa1; ID SAL --------- ---------100 1 200 2 300 3 100 4 400 5 400 5 800 7 --(in later)

You might also like