Statement Closing and Query Definition Deletion

You can close or delete at different levels. You can delete a query definition to make room for new query definitions. You can also delete (close) the statement that is running, without deleting the query definition itself.

Use the following functions as needed for your situation:

Query.Statement.close(String StatementName);
Query.delete(String QueryDefinitionName);

When you delete a query or a statement, all their subordinate artifacts are deleted as well, including result sets.

You can also close just the result set. See Close the Result Set after Collection.