create or replace procedure cursorforupdate as cursor crec is select emp_code,emp_name from emp where emp_name='xyz' for update; vempcode emp.emp_code%type; vempname emp.emp_name%type; begin open crec; loop fetch crec into vempcode, vempname; exit when crec%notfound; update emp set emp_number=vempcode where current of crec; end loop; commit; close crec; end;
you cannot write commit inside the loop of for update cursor.
No comments:
Post a Comment