I’m writing stored procedures and functions in Oracle which return ref cursors to ColdFusion and everything works fine. But everything I’ve read says that I need to explicitly close a cursor or ref cursor when I’m done with it, else I risk running out of handles later.
But if I close the cursor at the end of the function/stored proc, the data is not returned to ColdFusion.
So how do I close the ref cursor once I’m done with it?
Whenever the database connection is closed, the cursor will also be closed. In the CF admin, you have a limit to the number of database connections. If you use cfqueryparam for every value passed to Oracle, you will allow reuse of the same connection for the same query (unless a timeout has been reached). You have to make sure the cursor pool limit in Oracle and the connection limit in CF admin are in agreement. It sounds like this app has never had a problem, so that is probably the case.