SET AUTOFREE statement

Use the SET AUTOFREE statement to instruct the database server to enable or disable a memory-management feature that can free the memory allocated for a cursor automatically, as soon as the cursor is closed.

Syntax


1  SET AUTOFREE
1! ENABLED
2.1 DISABLED
2?  FOR
3.1 cursor_id
3.1 cursor_id_var
Element Description Restrictions Syntax
cursor_id Name of a cursor for which Autofree is to be reset Must already be declared within the program Identifier
cursor_id_var Host variable that holds the value of cursor_id Must store a cursor_id already declared in the program Must conform to language-specific rules for names.

Usage

This statement is an extension to the ANSI/ISO standard for SQL. You can use this statement only with .

When the Autofree feature is enabled for a cursor, and the cursor is subsequently closed, you do not need to explicitly use the FREE statement to release the memory that the database server allocated for the cursor. If you issue SET AUTOFREE but specify no option, the default is ENABLED.

The SET AUTOFREE statement that enables the Autofree feature must appear before the OPEN statement that opens a cursor. The SET AUTOFREE statement does not affect the memory allocated to a cursor that is already open. After a cursor is Autofree enabled, you cannot open that cursor a second time.