OPEN

From InterBase

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

TRANSACTION <transaction>

Name of the transaction that controls execution of OPEN

<cursor>

Name of a previously declared cursor to open

USING ­DESCRIPTOR <xsqlda>

Passes the values corresponding to the prepared statement’s parameters through the extended descriptor area (XSQLDA)

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

DECLARE CURSOR

Declares the cursor; the SELECT statement determines rows retrieved for the cursor

2

OPEN

Retrieves the rows specified for retrieval with DECLARE CURSOR; the resulting rows become the cursor’s active set

3

FETCH

Retrieves the current row from the active set, starting with the first row

  • Subsequent FETCH statements advance the cursor through the set

4

CLOSE

Closes the cursor and release system resources

Examples: The following embedded SQL statement opens a cursor:

EXEC SQL
OPEN C;

See Also

Advance To: