HOLD LOCATOR
The HOLD LOCATOR statement allows a LOB locator variable to retain its association with a value beyond a unit of work.
Invocation
This statement can only be embedded in an application program. It cannot be issued interactively. It is an executable statement that can be dynamically prepared. However, the EXECUTE statement with the USING clause must be used to execute the prepared statement. HOLD LOCATOR cannot be used with the EXECUTE IMMEDIATE statement.
Authorization
None required.
Syntax
.-,-------------. V | >>-HOLD LOCATOR----host-variable-+-----------------------------><
Description
- host-variable, ...
- Identifies one or more locator variables that must be declared
in accordance with the rules for declaring locator variables. The
locator variable type must be a binary large object locator, a character
large object locator, or a double-byte character large object locator.
The host-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, SELECT INTO, assignment statement, SET host-variable statement, or VALUES INTO statement); otherwise, an error is returned.
If more than one locator is specified and an error is returned on one of the locators, it is possible that some locators have been held and others have not been held.
Notes
A host-variable LOB locator variable that has the hold property is freed (has its association between it and its value removed) when:
- The SQL FREE LOCATOR statement is executed for the locator variable.
- The SQL ROLLBACK statement is executed.
- The SQL session is terminated.
Example
EXEC SQL HOLD LOCATOR :LOCRES, :LOCHIST, :LOCPIC