GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  PL/SQL
Go To First  |  Previous Question  |  Next Question 
 PL/SQL  |  Question 14 of 241    Print  
What will happen after commit statement ?
          Cursor C1 is
          Select empno,
          ename from emp;
          Begin
               open C1;            loop
                    Fetch C1 into
               eno.ename;
                    Exit When
               C1 %notfound;-----
                    commit;
               end loop;
               end;
 
The  cursor  having  query  as  SELECT  ....  FOR  UPDATE gets closed after COMMIT/ROLLBACK.
 
The  cursor  having  query  as  SELECT....  does  not get closed even after COMMIT/ROLLBACK.



  
Total Answers and Comments: 14 Last Update: November 19, 2009   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
  Sorting Options  
  Page 1 of 2   « First    1    2    >     Last »  
September 20, 2005 08:36:08   #1  
kishorebabukm        

RE: What will happen after commit statement...
The cursor having query will get closed because once the for update clause is fired it locks all the rows which is been modified and once it encounters a commit/rollback it automatically comes out of that session and will be processing a fresh loop altogether.
 
Is this answer useful? Yes | No
October 19, 2005 08:52:12   #2  
Bhanu        

RE: What will happen after commit statement...
DDL statements cannot be included in the pl/sql block. Hence giving commit is not allowed.
 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 2Overall Rating: -2    
February 23, 2006 01:05:31   #3  
hanthur Member Since: February 2006   Contribution: 1    

RE: What will happen after commit statement...
The changes will be permanently written to hard disk. No undo(rollback) is possible.
 
Is this answer useful? Yes | No
June 12, 2007 05:24:06   #4  
sunil        

RE: What will happen after commit statement...
All the Database Locks are Released after commit....
 
Is this answer useful? Yes | No
June 28, 2007 06:39:33   #5  
Prajyot Shelar        

RE: What will happen after commit statement...
When u will executed this statement into the server that's time commit mechanism will start to save a record as permanently into the database.
COMMIT statement it's part of TCL Language.

 
Is this answer useful? Yes | No
July 18, 2007 08:46:00   #6  
askvenki        

RE: What will happen after commit statement...
We cannot give commit inside a loop statement. Then we have to commit out side loop

 
Is this answer useful? Yes | No
July 20, 2007 04:50:16   #7  
vickyjp        

RE: What will happen after commit statement...
If the data set is too big commiting with-in the cursor loop might lead to the `Snapshot too old Error`.
 
Is this answer useful? Yes | No
August 12, 2007 10:28:14   #8  
bambino chakma        

RE: What will happen after commit statement...
after the commit statement the cursor get closed ...as the result no further rows can be fetched even though there are rows to be fetched.
 
Is this answer useful? Yes | No
November 12, 2007 04:18:12   #9  
ANY        

RE: What will happen after commit statement...
CURSOR WONT CLOSE AFTER COMMIT TRY THIS CODE

DECLARE
CURSOR C IS
SELECT * FROM EMP
WHERE ROWNUM <4;
R C ROWTYPE;
BEGIN
OPEN C;
LOOP
FETCH C INTO R;
DBMS_OUTPUT.PUT_LINE (R.EMPNO);
EXIT WHEN C NOTFOUND;
UPDATE EMP
SET SAL SAL-1;
COMMIT;
END LOOP;
CLOSE C;
END;

 
Is this answer useful? Yes | No
May 06, 2008 05:52:12   #10  
krishnaindia2007 Member Since: September 2007   Contribution: 854    

RE: What will happen after commit statement ?

Commit will not close a cursor.
Commit makes database changes permanent and releases all the locks on that table.


 
Is this answer useful? Yes | No
  Page 1 of 2   « First    1    2    >     Last »  


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape