'In what conditons DB will not close the cursor when executing a select query from cpp?

I have a piece of code in cpp which transforms to looks like this:

DBConnection dbConn;
SelectStatement selectStatement;
while (SOME_CONDITION){
1.Add conditon to selectStatement;
2.Execute select statement;
3.resultSet.next()
}

What i am observing is everytime it runs while loop it does not close the cursor but creates a new cursor. Please suggest the reason and possible resolution for the same.



Solution 1:[1]

It was because same variable was being used to create new connections and close it there.But it seems there is a concept until the variable is destroyed Oracle keeps the cursor open and for any new cursor requirement it will create a new one.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Paritosh Pradeep