closeQuery()
You must close an open database cursor for an SQL query by using the Database.closeQuery() function.
If you do not close the cursor, it results in database level exception as an open cursor is a limited resource at database level. Even if there is no exception, you must close all open cursors.
Example
Database.setCurrentConnection("/SharedResources/Oracle.sharedjdbc"); String jdbcURI="/SharedResources/HR_DB_Conn.sharedjdbc"; String cursorName="EmpCursor"; String resultTypeURI="/Concepts/HR/EMPLOYEES"; String sql="select * from employees"; int pageSize=10 ; Object requestObj=null; String cursorName=Database.createQuery(jdbcURI,cursorName,resultTypeURI,sql,pageSize,requestObj); System.debugOut(" Opened Cursor: " + cursorName); Database.closeQuery(cursorName);
Copyright © Cloud Software Group, Inc. All rights reserved.