NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
O-5
Considerations—OPEN
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
Authorization requirements
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.
Locking considerations
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 is required to order selected
rows. (A FETCH in the cursor acquires locks unless you specified BROWSE access
in the SELECT and subqueries.)
Order of cursor operations
To use a cursor, you must first declare it with DECLARE CURSOR and then open it
with OPEN. After a successful OPEN, you use FETCH to retrieve data.
You cannot open a cursor that is already open in the program. (Use CLOSE or FREE
RESOURCES to close a cursor prior to program termination.)
OPEN { cursor } [ USING :var [, :var ]... ]
{ :cursor-var } [ USING DESCRIPTOR :in-sqlda ]