|
Re: Ora-06511 - Cursor already open - Trigger raised unhandled exception. [message #550884 is a reply to message #550883] |
Fri, 13 April 2012 04:19 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Switch to cursor FOR loop, which handles such stuff for you.
Here, you opened a cursor, close it if c1%notfound or if financial_year_beg condition is met. But, you don't close it if it is not met so it stays opened and the next LOOP round tries to open it - but guess what - it is already open!
By the way, the way you use cursor C1 is unnecessary. You seem to be fetching a single value into F_DOC_DATE. To do that, you don't need a cursor - an ordinary SELECT statement is perfectly capable of doing it.
I'd say that this code should be rewritten in order to make it smaller and, hopefully, more efficient.
|
|
|
|
|