DB2 10.5 for Linux, UNIX, and Windows

ASSOCIATE LOCATORS statement

The ASSOCIATE LOCATORS statement gets the result set locator value for each result set returned by a procedure.

Invocation

This statement can only be embedded in an SQL procedure. It is not an executable statement and cannot be dynamically prepared.

Authorization

None required.

Syntax

Read syntax diagramSkip visual syntax diagram
              .-RESULT SET-.                 
>>-ASSOCIATE--+------------+--+-LOCATOR--+---------------------->
                              '-LOCATORS-'   

      .-,-------------------.                                      
      V                     |                                      
>--(----rs-locator-variable-+--)--WITH PROCEDURE--procedure-name-><

Description

rs-locator-variable
Specifies a result set locator variable that has been declared in a compound SQL (Procedure) statement.
WITH PROCEDURE
Identifies the procedure that returns result set locators by the specified procedure name.
procedure-name
A procedure name is a qualified or unqualified name.

A fully qualified procedure name is a two-part name. The first part is an identifier that contains the schema name of the procedure. The last part is an identifier that contains the name of the procedure. A period must separate each of the parts. Any or all of the parts can be a delimited identifier.

If the procedure name is unqualified, it has only one name because the implicit schema name is not added as a qualifier to the procedure name. Successful execution of the ASSOCIATE LOCATOR statement only requires that the unqualified procedure name in the statement be the same as the procedure name in the most recently executed CALL statement that was specified with an unqualified procedure name. The implicit schema name for the unqualified name in the CALL statement is not considered in the match. The rules for how the procedure name must be specified are described in the following paragraph.

When the ASSOCIATE LOCATORS statement is executed, the procedure name or specification must identify a procedure that the requester has already invoked using the CALL statement. The procedure name in the ASSOCIATE LOCATORS statement must be specified the same way that it was specified on the CALL statement. For example, if a two-part name was specified on the CALL statement, you must use a two-part name in the ASSOCIATE LOCATORS statement.

Notes

Examples

The statements in the following examples are assumed to be embedded in SQL Procedures.