SQL/MX 3.2 Reference Manual (H06.25+, J06.14+)
SQL/MX Statements
HP NonStop SQL/MX Release 3.2 Reference Manual—691117-001
2-160
C Examples of DELETE
select_list ............ execution_count
>>execute s1;
--- 1 row(s) deleted.
>>select * from test1;
COL1 COL2
----------- ----
1 100
--- 1 row(s) selected.
C Examples of DELETE
Remove the row for JOHN WALKER from the EMPLOYEE table:
EXEC SQL DELETE FROM PERSNL.EMPLOYEE
WHERE FIRST_NAME = 'JOHN' AND LAST_NAME = 'WALKER'
SERIALIZABLE ACCESS;
Use a cursor and delete some of the returned rows during processing:
...
EXEC SQL DECLARE emp_cursor CURSOR FOR
SELECT EMPNUM, DEPTNUM, JOBCODE, SALARY
FOR UPDATE ACCESS
FROM PERSNL.EMPLOYEE
SERIALIZABLE ACCESS;
...
EXEC SQL OPEN emp_cursor;
...
EXEC SQL FETCH emp_cursor
INTO :hv_empnum, :hv_deptnum, :hv_jobcode, :hv_salary;
... /* Process fetched row. */
if (hv_jobcode == 1234)
EXEC SQL DELETE FROM PERSNL.EMPLOYEE
WHERE CURRENT OF emp_cursor;
COBOL Examples of DELETE
Remove the row for JOHN WALKER from the EMPLOYEE table:
EXEC SQL DELETE FROM PERSNL.EMPLOYEE
WHERE FIRST_NAME = 'JOHN' AND LAST_NAME = 'WALKER'
SERIALIZABLE ACCESS
END-EXEC.










