SQL Reference

ALLOCATE CURSOR Statement

The ALLOCATE CURSOR statement allocates a cursor for the result set identified by the result set locator variable. See ASSOCIATE LOCATORS Statement for more information on result set locator variables.

Syntax

>>-ALLOCATE--cursor-name--CURSOR FOR RESULT SET--rs-locator-variable-->
 
>--------------------------------------------------------------><
 

Description

cursor-name
Specifies the cursor name. The name must not identify a cursor that has already been declared in the source SQL procedure (SQLSTATE 24502).

CURSOR FOR RESULT SET rs-locator-variable

Specifies a result set locator variable that has been declared in the source SQL procedure, according to the rules for host variables. For more information on declaring SQL variables, see SQL variable declaration.

The result set locator variable must contain a valid result set locator value, as returned by the ASSOCIATE LOCATORS SQL statement (SQLSTATE 24501).

Notes

Rules

Examples

This SQL procedure example defines and associates cursor C1 with the result set locator variable LOC1 and the related result set returned by the SQL procedure:

     ALLOCATE C1 CURSOR FOR RESULT SET LOC1;


[ Top of Page | Previous Page | Next Page ]