The FREE LOCATOR statement removes the association between a locator variable and its value.
Invocation
This statement can only be embedded in an application program. It is an executable statement that cannot be dynamically prepared.
Authorization
None required.
Syntax
.-,----------------. V | >>-FREE--LOCATOR-------variable-name---+-----------------------><
Description
The locator-variable must currently have a locator assigned to it. That is, a locator must have been assigned during this unit of work (by a FETCH statement or a SELECT INTO statement) and must not subsequently have been freed (by a FREE LOCATOR statement); otherwise, an error is raised (SQLSTATE 0F001).
If more than one locator is specified, all locators that can be freed will be freed, regardless of errors detected in other locators in the list.
Example
In a COBOL program, free the BLOB locator variables TKN-VIDEO and TKN-BUF and the CLOB locator variable LIFE-STORY-LOCATOR.
EXEC SQL FREE LOCATOR :TKN-VIDEO, :TKN-BUF, :LIFE-STORY-LOCATOR END-EXEC.