Progress
Embedded SQL-92
Guide and Reference
OPEN Statement
Executes a prepared SQL-92 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
cursor_name
An identifier named in an earlier DECLARE CURSOR Statement.
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.
EXAMPLEThis example is a code fragment from the
StatSel
function in the sample program 2StatSel.pc. This example illustrates the static processing of a SELECT statement. The complete source for the sample program is listed in "ESQL-92 Sample Programs."
NOTES
- Executing an OPEN Statement sets the cursor to the open state.
- After the OPEN Statement is executed, the cursor is positioned just before the first row of the active set.
- For a single execution of an OPEN 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 CLOSE the cursor and OPEN it again.
- Execution of a COMMIT or ROLLBACK statement implicitly closes the cursors that have been opened in the current transaction.
- It is good practice to CLOSE cursors explicitly.
- When a cursor is in the open state, executing an OPEN Statement on that cursor results in an error.
- If a DECLARE CURSOR Statement is associated with a static SQL-92 statement containing parameter markers, the following requirements apply:
- You must execute the DECLARE CURSOR Statement before executing the OPEN Statement for that cursor.
- The DECLARE CURSOR Statement and the OPEN Statement for the same cursor must occur in the same transaction.
- If the statement contains parameter markers for stack variables, the DECLARE CURSOR Statementand the following OPEN Statement for the same cursor must occur in the same C Language function.
AUTHORIZATION
The user executing this statement must have at least one of the following privileges:
SQL COMPLIANCE
SQL-92. Progress Extension: USING DESCRIPTOR clause
ENVIRONMENT
Embedded SQL-92 only
RELATED STATEMENTS
DECLARE CURSOR Statement, CLOSE Statement, FETCH Statement, positioned UPDATE, positioned DELETE
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |