SQL/MX 3.2.1 Programming Manual for C and COBOL (H06.26+, J06.15+)
Static Rowsets
HP NonStop SQL/MX Release 3.2.1 Programming Manual for C and COBOL—663854-005
7-14
Selecting Rows Into Rowset Arrays
SELECT projcode, projdesc, start_date
INTO :hvaprojcode, :hvaprojdesc, :hvastartdate
FROM project
WHERE start_date <= DATE '1998-12-01' END-EXEC.
EXEC SQL
GET DIAGNOSTICS :numrows = ROW_COUNT end-exec.
PERFORM VARYING i FROM 1 BY 1 UNTIL i > numrows
display "Project: " hvaprojcode(i) hvaprojdesc(i)
"Started: " hvastartdate(i)
END-PERFORM
...
Rowset Arrays as Input for SELECT Statements
A SELECT statement retrieves the values in one or more columns of the matching
rows. The matching rows are determined by the evaluation of the search condition in
the WHERE clause of the SELECT statement.
You can use rowset arrays as input in the WHERE clause search condition to specify
multiple values for the search condition in a single SQL statement. The use of rowset
arrays for input is similar to a looping mechanism whereby the same statement is
executed multiple times with a different set of values for input each time. You can use
rowset arrays as input in the HAVING clause search condition of a SELECT statement.










