title: ora-00604 : error occured at ecursive SQL level 1?
body: <p>I have java code written using Java 6 and ojdbc14.jar to connect to my oracle database and trying to get sequence id using below code:</p>
  
  <pre><code>long lNewAuditId = 0;
  
      Statement stmt = null;
      ResultSet result = null;
  
      try {
          stmt = argConnection.createStatement();
          result = stmt.executeQuery(SQL_NEXT_AUDIT_ID);
  
          if ( !result.next() )
              throw new DAOException("Error obtaining new Audit Id - no result");
  
          lNewAuditId = result.getLong(1);
          m_logger.debug("Next Audit Id: " + lNewAuditId);
  
      } 
      catch (SQLException sqle) 
      {
          throw new DAOException("Error getting next Audit id", sqle);            
      } 
      finally 
      {
          // do not close the connection here
          close(result);
          close(stmt);
      }
  </code></pre>
  
  <p>I hope I am closing stmt properly. While running this code, I am facing the below issue:</p>
  
  <pre><code>java.sql.SQLException: ORA-01000: maximum open cursors exceeded
  
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
      at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
      at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
      at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:957)
      at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1062)
      at oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:841)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1134)
      at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1274)
  </code></pre>