CONNX Data Integration Suite 14.8.0 | CONNX Embedded SQL for Adabas | Standard SQL Statements | OPEN
 
OPEN
Function
An OPEN statement establishes the contents of a cursor.
Invocation
Embedded Mode P Dynamic Mode Interactive Mode
Syntax
The OPEN statement syntax is OPEN with a cursor or host variable identifier, with optional CURSOR FOR statements with aditional identifiers, and an optional USING clause.
cursor_identifier
Identifies the cursor to be used.
host_variable_identifier_1
A valid single host variable identifier. It must be defined in the application program according to the host language rules. The value of the host variable must be a valid cursor identifier. A host variable can be used as cursor identifier only if the cursor is a dynamically declared cursor.
statement_identifier
A valid identifier denoting the name of the prepared statement.
host_variable_identifier_2
A valid single host variable identifier. It must be defined in the application program according to the host language rules. The value of the host variable must be the value returned by the PREPARE statement and thus identifies the prepared statement.
USING clause
Defines an SQL descriptor area used to supply data to the associated dynamic cursor.
Description
The OPEN statement causes the contents of the associated resultant table to be established. The cursor is initially positioned before the first row. The cursor can be identified by the use of a host variable only if the cursor is declared dynamically. Likewise, the USING clause can be used to provide input values only if the cursor is a dynamically declared cursor. Alternatively, values can be provided by the direct use of host variables.
Limitations
The cursor that will be opened must be declared and must not be open. If the statement does not contain a CURSOR FOR clause, the cursor must be declared prior the OPEN statement.
The statement must be in the same compilation unit as the associated DECLARE CURSOR statement.
ANSI Specifics
*All cursors that are open in a transaction are automatically closed by a COMMIT or ROLLBACK statement.
*The USING clause must not be used.
*The associated DECLARE CURSOR statement must physically precede the OPEN statement in the host program.
CONNX Embedded SQL Specifics
*The CLOSE statement is the only statement (apart from the DISCONNECT) statement that closes a cursor.
*The cursor identifier can be given as a host variable if the cursor has been dynamically prepared.
*The OPEN statement may appear anywhere in relation to the associated cursor statement in the host language.
*DML statements must not be mixed with DDL/DCL statements in the same transaction.
Here is an example on how to open a cursor:
OPEN cursor1 ;
Here is an example on how to open a dynamic cursor and provide values within host variables.
OPEN cursor1 USING :hv1, :hv2, :hv3 ;