/* ----- 41d.sql -----*/ /* Example of using a cursor with implicit fetch */ set echo on; drop table TEST; create table TEST (NR1 number(3), NR2 number(3)); begin -- insert values into table TEST for i in 1..20 loop insert into TEST values(null,i); end loop; commit; end; / declare x number(4) := 0; cursor T_CUR is select * from TEST order by NR2 desc for update of NR1; begin for T_REC in T_CUR loop update TEST set NR1 = x where current of T_CUR; x := x + 1; end loop; commit; end; / select * from TEST;