René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

example showing udpate table where current of

create table test_for_cursor (
  i number(3),
  c varchar(50)
);


insert into test_for_cursor values (1,  'one');
insert into test_for_cursor values (10, 'ten');
insert into test_for_cursor values (5, 'five');
insert into test_for_cursor values (99, 'ninety-nine');
insert into test_for_cursor values (42, 'forty-two');


commit;

declare
  cursor cur_test is 
    select i, c from test_for_cursor for update;
  
  i number(3);
  c varchar(50);
begin
  open cur_test;

  loop
    fetch cur_test into i, c;
    
    exit when cur_test%notfound; 

    if i>12 then
      update test_for_cursor set i=i*2, c=upper(c) where current of cur_test;
    end if;
  end loop;

end;
/