Progress
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 sample program2StatSel.pc
, which illustrates static processing of a SELECT statement. The complete source for sample program,2StatSel.pc
, is listed in Appendix A of the Progress Embedded SQL-92 Guide and Reference .
NOTES
- Executing an OPEN cursor statement sets the cursor to the open state.
- After the OPEN cursor statement is executed, the cursor is positioned just before the first row of the active set.
- For a single execution of an OPEN cursor 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 Statement or ROLLBACK Statement implicitly closes the cursors which 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 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 statement and the following OPEN statement for the same cursor must occur in the same C Language function.
AUTHORIZATION
Must have DBA privilege of SELECT privilege on all the tables and views referenced in the SELECT statement associated with the cursor.
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 Statement, positioned DELETE Statement
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |