| Cursor Already Open [message #338231] |
Mon, 04 August 2008 04:49  |
gdottorini
Messages: 23 Registered: November 2006 Location: Napoli
|
Junior Member |
|
|
Good Morning,
i'm getting the error ORA-06511 but i don't know what is the cursor opened.
Suppose i've this situation
Procedure PRC_Main (param ...) is
[declaration]
Begin
...
-- Call the external procedures
pkg_first.first_procedure (....);
pkg_second.second_procedure (....);
-- and so on
Exception when others then
-- display error code and error message
End PRC_Main;
The question: anyone knows if is it possible to get the cursor name and close it. Or anynone knows if is it possible to close all cursors? Or do i have to manage the error inside each package?
Thanks in advance.
Regards,
Giulio
|
|
|
|
|
|
|
|
| Re: Cursor Already Open [message #338261 is a reply to message #338231] |
Mon, 04 August 2008 06:03   |
gdottorini
Messages: 23 Registered: November 2006 Location: Napoli
|
Junior Member |
|
|
Hi Michel,
Hi LittleFoot,
the question is because i don't know what is the cursor that reamins opened after an unexpected error.
The code inside the packages called from the procedure is written using this schema:
Open cursor-n;
Loop
fetch cursor-n into variables;
exit when cursor-n%notfound;
statements
...
End loop;
Close cursor-n;
if something happens (for example, error due to data) in the statements inside the loop, i do not manage the error and the cursors remains opened.
What i want to know is just the name of the cursor, to try to understand where the code doesn't manage the errors.
Thank you for your interesting.
Ciao,
Giulio
|
|
|
|
|
|
| Re: Cursor Already Open [message #338282 is a reply to message #338266] |
Mon, 04 August 2008 07:49   |
gdottorini
Messages: 23 Registered: November 2006 Location: Napoli
|
Junior Member |
|
|
Hi,
yes i know that Michel is quite right.
I even knew the instruction that you suggest to me.
Want i would like is the name of "Cursorname". But i've understood that is not possible in pl/sql, so i'll review the code inside the packages.
Thanks to everyone.
Ciao,
Giulio
|
|
|
|
| Re: Cursor Already Open [message #338292 is a reply to message #338282] |
Mon, 04 August 2008 08:09   |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
While you are at it, read up on 21st century cursor loops.
Don't open-fetch-close manually, use for <record> in <cursor> loops.
They will handle open and close for you. Then get rid of all your unnecessary (in fact: error-prone or even erroneous) exception handlers and you have hardened your code by at least 50% with very very little effort.
|
|
|
|
|
|