ABAP Keyword Documentation → ABAP - Reference → Processing External Data → ABAP Database Accesses → Open SQL → Open SQL - Writes → DELETE dbtab
DELETE dbtab - cond
Other versions: 7.31 | 7.40 | 7.54
Syntax
... WHERE sql_cond.
Effect
The WHERE
addition uses a logical expression sql_cond
to specify which rows in the database table or view 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 database row that satisfies the
WHERE
condition, then no rows are deleted and sy-subrc
is set to 4. If no WHERE
condition is specified, all the rows are deleted.
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.