SQL/MX 2.x Reference Manual (G06.24+, H06.03+)
Embedded-Only SQL/MX Statements
HP NonStop SQL/MX Reference Manual—523725-004
3-42
Considerations for FETCH
INTO argument-list
specifies host variables. The number of row values must be equal to the number of
specified host variables, and the data type of each source value must be
compatible with the data type of its target host variable. The first value in the result
row is assigned to the first host variable, the second value to the second variable,
and so on.
:variable-name
is a variable specification—a host variable. A variable name begins with a
colon (:).
Considerations for FETCH
Authorization Requirements
FETCH requires read access to any tables or views associated with the cursor or
iterator. Updating fetched rows requires write access to the table or view.
Ordering Fetched Rows
Successive executions of FETCH retrieve successive rows in the result table of the
cursor specification or iterator.
To control the order in which the rows appear, include an ORDER BY clause in the
cursor specification part of DECLARE CURSOR or in the prepared statement in the
case of a dynamic cursor.
To control the order in which the rows appear, include an ORDER BY clause in the
SELECT statement that is bound to the iterator.
Too Many Values or Too Many Variables
If the number of host variables is different from the number of columns in the result
table, the execution of FETCH raises an error condition.
Using Extended Dynamic Cursors
The name of an extended dynamic cursor is not known until run time. When FETCH
executes, the name must identify an open cursor within the same scope.
Status Information
You must declare the variables SQLSTATE or SQLCODE in your module or
compilation unit. For information on declaring SQLCODE and SQLSTATE, see the
SQL/MX Programming Manual for C and COBOL.
Java
C/COBOL
Java
C/COBOL
C/COBOL