SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
O-5
OPEN Statement
OPEN Statement
OPEN is a DML statement that opens a cursor in a host program. OPEN executes the
SELECT associated with the cursor, positions the cursor before the first row selected,
and returns statistics to the SQLSA.
In dynamic SQL, OPEN also specifies parameters for the SELECT.
cursor
is the name of a cursor defined by DECLARE CURSOR.
:cursor-var
(dynamic SQL only) is the name of a host variable of SQL type CHAR or
VARCHAR that contains the name of a cursor defined by DECLARE CURSOR.
USING :var [, :var ]...
(dynamic SQL only) specifies host variables that contain values for parameters
used in a FETCH command for the cursor. Use this clause when you know the
descriptions of parameters in the prepared SELECT.
USING DESCRIPTOR :in-sqlda
(dynamic SQL only) specifies an SQLDA filled by DESCRIBE INPUT that points to
values for parameters used in a FETCH for the cursor. Use this clause when you
do not know the descriptions of parameters in the prepared SELECT.
Considerations—OPEN
To execute OPEN, you must have read authority for tables or protection views
referred to in the SELECT associated with the cursor. If the cursor refers to a
shorthand view, you must have read authority for tables or protection views
underlying the shorthand view. If the cursor was declared FOR UPDATE, you must
also have write authority to the tables.
If a cursor is declared on audited tables or protection views and acquires locks, a
TMF transaction must be in progress when you open the cursor. The OPEN
statement associates the cursor with the transaction.
OPEN itself acquires no locks unless a sort operation must order selected rows. (A
FETCH in the cursor acquires locks unless you specify BROWSE access in the
SELECT and subqueries.)
OPEN { cursor } [ USING :var [, :var ]... ]
{ :cursor-var } [ USING DESCRIPTOR :in-sqlda ]