Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP - Database Accesses →  Open SQL →  Open SQL - Write Accesses →  DELETE dbtab 

DELETE dbtab - cond

Short Reference

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 are deleted from the database table. The same rules apply to the logical expression sql_cond as to the WHERE condition of the SELECT statement, with the exception that subqueries cannot be evaluated in the database table to be changed. If there is no row in the database that fulfills the WHERE condition, a row is not deleted and sy-subrc is set to 4. If a WHERE condition is not specified, all rows are deleted.


Example

All of an airline's flights that are scheduled for today and in which no seats are occupied are deleted from database table SFLIGHT (also see the example for dtab-source).

PARAMETERS p_carrid TYPE sflight-carrid. 

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