top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

What will be the O/P for this coding?

0 votes
151 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
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...