SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
Simple and Compound Statements
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
5-9
Searched UPDATE Statement
 INTERVAL DAY TO SECOND(4) hv_day_time;
 ...
EXEC SQL END DECLARE SECTION; 
...
... /* Initialize host variables for new row */ 
strcpy(hv_year_month, "63-04"); 
strcpy(hv_day_time, "25:08:14:12.0000"); 
...
EXEC SQL INSERT INTO RETIREES 
 (..., AGE, LAST_TIMECARD) 
 VALUES(..., :hv_year_month,
 :hv_day_time);
...
COBOL Interval Example
A table includes a column with a year-month interval and a column with a day-time 
interval. This example inserts a new row into this table:
EXEC SQL BEGIN DECLARE SECTION END-EXEC. 
 01 HV-YEAR-MONTH INTERVAL DAY TO MONTH.
 01 HV-DAY-TIME INTERVAL DAY TO SECOND(4).
 ...
EXEC SQL END DECLARE SECTION END-EXEC. 
 ...
* Initialize host variables for new row 
 ...
 MOVE "63-04" TO HV-YEAR-MONTH.
 MOVE "25:08:14:12.0000" TO HV-DAY-TIME. 
 ...
 EXEC SQL INSERT INTO RETIREES 
 (..., AGE, LAST_TIMECARD) 
 VALUES(..., 
 :HV-YEAR-MONTH,
 :HV-DAY-TIME)
 END-EXEC. 
 ...
Searched UPDATE Statement 
The searched UPDATE statement updates the values in one or more columns in either 
a single row or in a set of rows of a table. The selection of the rows to be updated is 
based on a search condition. Use this general syntax: 
For complete syntax, see UPDATE statement in the SQL/MX Reference Manual. To 
update a set of rows one row at a time by using a cursor, see Section 6, Static SQL 
Cursors. 
UPDATE table-name 
 SET set-clause-list WHERE search-condition 
COBOL










