DELETE dbtab - cond

Syntax

... WHERE sql_cond.

Effect

The WHERE addition uses a logical expression sql_cond to specify which rows in the database table are deleted. The same applies to the logical expression sql_cond as for the WHERE condition of the SELECT statement, with the exception that no subqueries can be executed on the database table to be changed. If there is no row in the database that satisfies the WHERE condition, no row is deleted and sy-subrc is set to 4. If no WHERE condition is specified, all rows are deleted.

Note

As of Release 6.10, specifying the WHERE condition is optional. Prior to Release 6.10, you had to specify the WHERE condition in this variant of the DELETE statement and you could not use dynamic logical expressions.

Example

In the following example, all an airline's flights for today in which no seats are occupied are deleted from the database table SFLIGHT (see also, example to dtab-source).

PARAMETERS p_carrid TYPE sflight-carrid.

DELETE FROM sflight
WHERE  carrid = p_carrid AND
       fldate = sy-datum AND
       seatsocc = 0.