SQL/MX 2.x Reference Manual (G06.24+, H06.03+)

Embedded-Only SQL/MX Statements
HP NonStop SQL/MX Reference Manual523725-004
3-74
Considerations for OPEN
USING variable-spec [,variable-spec]...
(dynamic SQL) identifies the host variables for the dynamic input parameters of the
cursor specification.
Before OPEN with USING executes, the application must store information for
each parameter of the cursor specification in the appropriate host variable.
USING SQL DESCRIPTOR descriptor-name
(dynamic SQL) identifies the SQL descriptor area for the dynamic input parameters
of the cursor specification. An SQL descriptor area must be currently allocated
whose name is the value of descriptor-name and whose scope is the same
scope as specified in the OPEN statement.
Before OPEN with USING executes, the application must store information for
each input parameter of the cursor specification in the descriptor area. Each
parameter has an item descriptor.
Considerations for OPEN
Establishing the Result Table
If the cursor specification includes embedded variables, the variables are evaluated
when OPEN executes. Any subsequent changes to those variables do not affect the
result table of the cursor specification.
Authorization Requirements
To execute OPEN, you must have read authority for tables or views referred to in the
SELECT associated with the cursor. If the cursor was declared FOR UPDATE, you
must also have write authority to the tables.
Declaring Host Variables
The host variables occurring in the cursor specification must be declared within the
scope of the OPEN statement. Otherwise, an error occurs during preprocessing.
Using Extended Dynamic Cursors
The name of an extended dynamic cursor is not known until run time. When OPEN
executes, the name must identify an allocated cursor within the same scope.