Link to home
Start Free TrialLog in
Avatar of Arikkan
ArikkanFlag for United States of America

asked on

Maximum open cursor reached issue in Vb.net application connecting to Oracle database

Hi Experts,

I'm having an issue of oracle cursor in my VB.net application. I'm using Oracle connection to connect to Oracle DB, and have a transaction. Within transaction there are insert and select statement. When oracle reaches to its maximum cursor defined in oracle DB, it's throwing an exception of "Maximum open cursor reached" in Vb.net application.  

Since I'm using transaction, I cannot close the connection until transaction is done. I don't know why "ExecuteNonQuery" is creating a new cursor. If i have 1000 records in transaction, it's opening 1000 cursor in the DB, one cursor for each "ExecuteNonQuery"

Is there any way to avoid this cursor issue? I already tried disposing the command object but no luck.
Avatar of Mark Geerlings
Mark Geerlings
Flag of United States of America image

I don't use VB, so I can't help you inside VB.  But, could you write your code in PL\SQL instead and compile it as a stored procedure that can accept input parameters, then call that procedure from your VB.net application?
Avatar of Arikkan

ASKER

The issue is not with Input parameter. It's creating cursor for each "ExecuteNonQuery" function. even if we use stored procedure "ExecuteNonQuery" needs to be executed.
But, if all of the logic is in PL\SQL instead of in VB, you may need to make only one call to "ExecuteNonQuery", that is, assuming you can pass the values needed to PL\SQL in the one procedure call.  Or, you may be able to create and populate  a "work" table with the parameter values you need, then have the PL\SQL procedure use a cursor loop to fetch each set of values from the work table and do the Oracle processing that you need.
ASKER CERTIFIED SOLUTION
Avatar of Arikkan
Arikkan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Arikkan

ASKER

I did resolve it by myself