Using the FOR Clause to Specify a Specific Cursor

If you specify FOR cursor _id or FOR cursor_id_var, then SET AUTOFREE affects only the cursor that you specify after the FOR keyword.

This option allows you to override a global setting for all cursors. For example, if you issue a SET AUTOFREE ENABLED statement for all cursors in a program, you can issue a subsequent SET AUTOFREE DISABLED FOR statement to disable the Autofree feature for a specific cursor.

In the following example, the first statement enables the Autofree feature for all cursors, while the second statement disables the Autofree feature for the cursor named x1:
EXEC SQL set autofree enabled;
EXEC SQL set autofree disabled for x1;

Here the x1 cursor must have been declared but not yet opened.