OPEN
Go Up to Statement and Function Reference (Language Reference Guide)
Retrieve specified rows from a cursor declaration. Available in gpre and DSQL.
SQL form:
OPEN [TRANSACTION transaction] cursor;
DSQL form:
OPEN [TRANSACTION transaction] cursor [USING SQL DESCRIPTOR xsqlda]
Blob form: See OPEN (BLOB)..
| Argument | Description |
|---|---|
|
|
Name of the transaction that controls execution of |
|
<cursor> |
Name of a previously declared cursor to open |
|
|
Passes the values corresponding to the prepared statement’s parameters through the extended descriptor area ( |
Description: OPEN evaluates the search condition specified in a cursor’s DECLARE CURSOR statement. The selected rows become the active set for the cursor.
A cursor is a one-way pointer into the ordered set of rows retrieved by the SELECT in a DECLARE CURSOR statement. It enables sequential access to retrieved rows in turn. There are four related cursor statements:
| Stage | Statement | Purpose |
|---|---|---|
|
1 |
|
Declares the cursor; the |
|
2 |
|
Retrieves the rows specified for retrieval with |
|
3 |
|
Retrieves the current row from the active set, starting with the first row
|
|
4 |
|
Closes the cursor and release system resources |
Examples: The following embedded SQL statement opens a cursor:
EXEC SQL
OPEN C;