OPEN
- Last Updated: December 12, 2014
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
Executes a prepared SQL query associated with a cursor and creates a result set composed of the rows that satisfy the query. This set of rows is called the active set.
Syntax
|
Parameters
- cursor_name
-
An identifier named in an earlier
DECLARE CURSORstatement. - USING [ SQL ] DESCRIPTOR structure_name
-
Directs the SQL engine to create the result set in storage addressed by the identified SQLDA structure.
- USING :host_variable[[ INDICATOR ] :ind_variable]
-
Directs the SQL engine to create the result set in storage addressed by host variables.
Notes
- Executing
an
OPENcursor statement sets the cursor to the open state. - After the
OPENcursor statement is executed, the cursor is positioned just before the first row of the active set. - For a single execution of an
OPENcursor statement, the active set does not change and the host variables are not re-examined. - If you elect to retrieve a new active set and a host variable
value has changed, you must
CLOSEthe cursor andOPENit again. - Execution of a
COMMITstatement orROLLBACKstatement implicitly closes the cursors that have been opened in the current transaction. - It is good practice to
CLOSEcursors explicitly. - When a cursor is in the open state, executing an
OPENstatement on that cursor results in an error. - If a
DECLAREcursor statement is associated with a static SQL statement containing parameter markers, the following requirements apply:- You must execute the
DECLAREstatement before executing theOPENstatement for that cursor. - The
DECLAREcursor statement and theOPENstatement for the same cursor must occur in the same transaction. - If the statement contains parameter markers for stack variables, the
DECLAREcursor statement and the followingOPENstatement for the same cursor must occur in the same C Language function.
- You must execute the
Example
|