PL/SQL Block Cursor

Scenario: I forgot to Close the Cursor in PL/SQL block. I executed the block successfully. Again I am going to execute that block without Closing the cursor. An error will be thrown or not?

Showing Answers 1 - 3 of 3 Answers

M Shaun Varney

  • May 13th, 2017
 

That depends. If the cursor is declared inside the block in question, it will be automatically closed when the block ends and you will not get an error when you open it again. However, if the cursor is declared in higher scope than that block which opens it (i.e. a package-level cursor opened in a procedure in the package) then it will NOT be automatically closed and you WILL get an error when you try to open the cursor again.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions