I am facing ORA-01000: maximum open cursors exceeded although I am closing the resultsets in finally block. But I suspect there is some trouble with my legacy code, below is my pseudo-code
while (someCondition) {
rs1=executePreparedStatementNew(query1,param1,"");
//do something with rs1
rs1=executePreparedStatementNew(query2,param2,"");
}
- If the loops runs 5 times, how many cursor will be opened by this code ?
- If I close rs1 in finally, how many cursors will be closed, some people say that rs1 instance for query1 will not be closed as it is masked by query2 instance.
- Does resultsets really gets masked this way , if so, how to ensure that all the instances are closed.
Appreciate any help.