Discussion:
Closed Cursor SQL -501
(too old to reply)
p***@gmail.com
2019-07-02 14:13:54 UTC
Permalink
I got a -501 error indicating the cursor was closed during a fetch. I know for a fact that the cursor was opened properly and that it was not intentionally closed. I do no database updates either, so I know I don't need a WITH HOLD on it.

I did trap a -305 error (null value returned) on a separate SQL SELECT statement prior to the fetch. Is it possible that this closed the cursor? I know some SQL return codes will close a cursor, but I can't find a definitive list anywhere.

Thanks in advance
m***@yahoo.com
2019-07-04 08:10:27 UTC
Permalink
Not enough detail in your question to give an answer. No code and no platform/environment/version/programming-language details etc.

Do some debugging. If the problem is reproducible that will be easier. If the -501 does not repeat on demand, use code inspection , check for uncaught or ignored exceptions, check database diagnostics, check all code paths .
Continue reading on narkive:
Loading...