top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What will be the O/P for this coding?

0 votes
390 views
 declare
 Cursor c1 is select * from emp for update;
 z c1%rowtype; 
begin
 open c1; 
fetch c1 into z;
 commit;
 fetch c1 into z;
 end;
posted Aug 20, 2014 by Rathi

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

It will throw an error like "ORA-01002: fetch out of sequence"

because if the cursor has been opened again fetching after a COMMIT has been issued will return the error.

Workaround: Do not issue a COMMIT inside a fetch loop for a cursor that has been opened FOR UPDATE.

answer Sep 17, 2014 by Arun Gowda
...