My Oracle Support Banner

Reference Cursor Used in Pro*C/Pro*COBOL Application Is Not Being Closed, Raises ORA-01000/ORA-01002 (Doc ID 2530006.1)

Last updated on DECEMBER 23, 2019

Applies to:

Precompilers - Version and later
Information in this document applies to any platform.


A reference cursor declared in a Pro*C function is passed as a parameter to a PL/SQL package, fetched and then closed subsequently. However, the cursor doesn't get closed. The same can be verified by executing the following query in a different session when the Pro*C function is called in a loop. The number returned by the query keeps on increasing.

If the above function is invoked in a loop and the 10046 trace is collected(at level 12), it doesn't show any CLOSE statement for the cursor being allocated in the code. The session finally runs out of cursors and raises the error ORA-01000("maximum open cursors exceeded"). After this all the open cursors are closed. It has also been observed that, in the above code, if the commented lines are made active i.e. the reference cursor is closed using the call to the PL/SQL procedure, then the program continues to work fine. The same symptom can be observed with a Pro*COBOL code also.


Database is upgraded to version It works absolutely fine till 


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.