Free resources
Sometimes you can ignore the cost of resources allocated
to prepared statements and cursors. However, the number of prepared
objects that the application can create is limited. Free resources
that uses
to execute a prepared statement, as follows:
- If the statement is associated with a cursor, use CLOSE to close the cursor after all the rows are fetched (or inserted).
- Use the FREE statement to release the resources allocated for the prepared statement and any associated cursor. After you have freed a prepared statement, you can no longer use it in your program until you reprepare or redeclare it. However, once you declare the cursor, you can free the associated statement identifier but not affect the cursor.
You can use the AUTOFREE feature to have the database server automatically free resources for a cursor and its prepared statement.
If your program uses a dynamic-management structure to describe an SQL statement at run time, also deallocate the resources of this structure once the structure is no longer needed.