SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)

Static Rowsets
HP NonStop SQL/MX Programming Manual for C and COBOL523627-004
7-21
Specifying Size and Row ID for Rowset Arrays
using the rowset-derived table syntax presented in Selecting From Rowset-Derived
Tables With a Cursor on page 7-32.
To specify a ROWSET FOR clause for a DML statement that uses rowsets directly,
use:
INPUT SIZE 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.
OUTPUT SIZE rowset-size-out
restricts the size of the output 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 signed long in C and its
corresponding equivalent 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. This option is not supported in a cursor
declaration. OUTPUT SIZE works only with SELECT ... INTO type statements.
KEY BY row-id
is a zero-based index that identifies each row in the result set 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 result set 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.
EXEC SQL
ROWSET FOR [size-and-index]
SQL-statement;
size-and-index is:
| INPUT SIZE rowset-size-in
| OUTPUT SIZE rowset-size-out
| KEY BY row-id
| INPUT SIZE rowset-size-in, OUTPUT SIZE rowset-size-out
| INPUT SIZE rowset-size-in, KEY BY row-id
| OUTPUT SIZE rowset-size-out, KEY BY row-id
| INPUT SIZE rowset-size-in, OUTPUT SIZE rowset-size-out, KEY
BY row-id