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-17
Updating Rows by Using Rowset Arrays
INSERT INTO employee
VALUES ( :hvaempnum, :hvafirstname, :hvalastname,
:hvadeptnum, :hvajobcode,
:hvasalary INDICATOR :hvasalaryindicator)
END-EXEC.
...
Inserting a Timestamp Value
You do not need to use the CAST function when inserting a TIMESTAMP value.
Example
This example inserts multiple rows into the PROJECT table, including a TIMESTAMP
value in the SHIP_TIMESTAMP column:
EXEC SQL BEGIN DECLARE SECTION;
char SQLSTATE[6];
ROWSET [10] TIMESTAMP hva_timestamp;
...
EXEC SQL END DECLARE SECTION;
long i;
...
/* Populate the host variable arrays in some way. */
...
EXEC SQL INSERT INTO PROJECT
(..., SHIP_TIMESTAMP, ...)
VALUES(..., :hva_timestamp, ...);
...
EXEC SQL BEGIN DECLARE SECTION END-EXEC.
01 sqlstate pic x(5).
01 rs.
02 ROWSET[10] hvaempnum pic 9(4) comp.
02 ROWSET[10] hvaprojcode pic 9(4) comp.
02 ROWSET[10] hvatimestamp TIMESTAMP.
EXEC SQL END DECLARE SECTION END-EXEC.
01 i pic s9(4) comp.
...
**** Populate the host variables arrays in some way *****
EXEC SQL INSERT INTO project
( empnum,projcode,ship_timestamp)
VALUES (:hvaempnum,:hvaprojcode, :hvatimestamp) END-EXEC.
...
Updating Rows by Using Rowset Arrays
The searched UPDATE statement updates the values in one or more columns of the
matching rows of a table or view. The matching rows are determined by the evaluation
of the search condition in the WHERE clause of the UPDATE statement. You can
perform multiple logical executions of the statement by using arrays of values in the
WHERE clause. Use of array host variables in the SET clause is optional.
C
COBOL