Start of change

DELETE

The DELETE statement deletes rows from a table.

The searched DELETE form is used to delete one or more rows, optionally determined by a search condition.

Invocation

This statement can be embedded in a COBOL or Java application program or issued interactively.

DELETE syntax

Read syntax diagramSkip visual syntax diagram
>>-DELETE-- FROM----| table |----+-------------------------+---><
                                 '-WHERE--search-condition-'   

table syntax

Read syntax diagramSkip visual syntax diagram
>>-+----------------+---table-name-----------------------------><
   '-schema-name--.-'                  

Description

The following keyword parameters are defined for the DELETE statement:
DELETE FROM
Identifies the table from which rows are to be deleted.
table-name
The table-name defines the name of the table in your SQL query. The name must identify a segment in IMS™.
schema-name
The schema-name defines the schema in your SQL query. In IMS, the schema name is the PCB name.
WHERE
Specifies the rows to be deleted. You can omit the clause or give a search condition. When the clause is omitted, all the rows of the table are deleted.
search-condition
Is any search condition as described in Search conditions. Each column-name in the search condition must identify a column of the table.

The search condition is applied to each row of the table and the rows are those for which the result of the search condition is true are deleted.

Example

From the table PCB01.HOSPITAL, delete all rows for hospitals Alexandria and Santa Teresa.

  DELETE FROM PCB01.HOSPITAL WHERE HOSPNAME = 'Alexandria' OR HOSPNAME = 'Santa Teresa';
End of change