3. Statements : OpenROAD SQL Statements : Open Statement
 
Share this page                  
Open Statement
This statement opens a cursor in the database, evaluates the specified statement, and associates the select statement's result table with the cursor.
This statement has the following syntax:
open cursor_variable for select_statement
          
[for update_clause];
where update_clause is one of the following:
readonly [deferred | direct] update of column{, column}
The open statement performs the following actions:
Opens a cursor in the database
Evaluates the specified select statement and positions the cursor immediately before the first row in the select statement's result table
Sets the State attribute to CS_OPEN
You must use the open statement before you can use any data manipulation statements (fetch, update, or delete) with the cursor. After the cursor is open, it stays open until you close it with the close statement or until the transaction terminates.
The select statement retrieves a set of rows from the database. These rows are then associated with the cursor. (The set of rows is called a result table.) The target list of the select statement can use any of the following formats:
resultname = dbexpression
dbexpression
as resultname
*
correlation_name.*
dbexpression
Note:  The asterisk selects values from all columns.
See Select Statement (see Select Statement) for a complete description of its syntax. If you intend to specify the "for update" clause (described in the next section) in your open statement, its associated select statement can reference only one table and cannot contain a distinct, group by, having, order by, or union clause.