DELETE (Searched)

Removes table rows that meet the search criteria.

Syntax:

>>--EXEC SQL--.-------------------.--->
              +-FOR :host_integer-+           

 >--.-------------.--DELETE--.------.--->
    +-AT db_name--+          +-FROM-+

 >--.-table_name-.--.-------------------------.-END-EXEC-><
    +--view_name-+  +-WHERE search_conditions-+

Parameters:

host_integer A host variable that specifies the maximum number of host array elements processed. Must be declared as PIC S9(4) COMP-5 or PIC S9(9) COMP-5.
AT db_name The name of a database that has been declared using DECLARE DATABASE. This clause is optional. If omitted, the current connection is deleted. If provided, and the connection specified is different than the current connection, the delete is performed on the connection associated with the DECLARE CURSOR statement.
FROM An optional keyword. It is required for ANSI SQL 92 conformance.
table_name The target table for the delete operation.
view_name The target view for the delete operation.
WHERE A standard SQL WHERE clause identifying the row to be deleted.
search_conditions Any valid expression that can follow the standard SQL WHERE clause.

Comments:

DELETE is a standard SQL statement. See the documentation supplied with your ODBC driver for the exact syntax.

You cannot mix simple host variables with host arrays in the WHERE clause. If one of the host variables is an array, they must all be arrays.

If you do not specify a WHERE clause, all of the rows in the named table are removed.

Example:

EXEC SQL
   DELETE FROM staff WHERE staff_id = 99
END-EXEC