SQL/MX 2.x Reference Manual (H06.04+)

Embedded-Only SQL/MX Statements
HP NonStop SQL/MX Reference Manual540440-003
3-24
Considerations for DECLARE CURSOR
GLOBAL | LOCAL
specifies the scope of the value specification for an ext-cursor-name. The
default is LOCAL. The scope of a GLOBAL cursor is the SQL session. The
scope of a LOCAL cursor is the module or compilation unit in which DECLARE
CURSOR appears.
ext-statement-name
is a value specification—a character literal or host variable with character data
type.
The ext-cursor-name and the ext-statement-name must both be named in
the same way—either both as character literals or both as host variables. When
host variables are used, the DECLARE CURSOR statement is functionally
equivalent to the ALLOCATE CURSOR statement.
rowset-size-in
restricts the size of the input rowset to the specified size, which must be less than
or equal to the allocated size for the rowset. The size is an integer literal (exact
numeric literal) or a host variable whose type is either unsigned short, signed short,
unsigned long, or signed long in C and their corresponding equivalents in COBOL.
By default, if the size is not specified, NonStop SQL/MX uses the allocated rowset
size specified in the SQL Declare Section of the embedded SQL program.
index-identifier
is a zero-based index that identifies each row in the matching columns of a
SELECT or FETCH statement with the particular search-condition in the WHERE
clause that caused the row to be part of the result set. For example, if the row-id
value for a certain row in the matching columns is 0 (zero), this row matches the
search-condition in the first element of the host variable arrays (array index 0 in C,
array index 1 in COBOL) in the WHERE clause.
SQL-statement
is any embedded DML statement that uses rowsets directly.
Considerations for DECLARE CURSOR
When DECLARE CURSOR executes, the content of the host variable (if used) must
identify a statement previously prepared within the scope of DECLARE CURSOR. The
prepared statement must be a cursor specification.
Default for Updatability
You can use updatable cursors only if the query expression involves a single table and
simple scan and does not include joins, unions, aggregates, and so on. Suppose that
the query expression meets these criteria for updatability: