Skip to content

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

DELETE dbtab

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


DELETE { {FROM target [WHERE sql_cond]} 
       | {target FROM source} }.

Effect

The statement DELETE deletes one or more rows from the database table specified in target. The rows that are to be deleted are declared either in a WHERE condition sql_cond or with data objects in source.

System Fields

sy-subrc Meaning
0 In the declaration of a WHERE condition, at least one row was deleted.In the declaration of a work area in source, the declared row was deleted.In the declaration of an internal table in source, all declared rows were deleted or the internal table is empty. If no conditions were declared, all rows were deleted.
4 When specifying a WHERE condition or a work area in source,no rows were deleted. When specifying an internal table in source, all specifiedrows were deleted. If no conditions were specified, no rows were deleted, since the database table was already empty.

The statement DELETE sets sy-dbcnt to the number of deleted rows. If an overflow occurs because the number or rows is greater than 2,147,483,647, sy-dbcnt is set to -1.


Notes

  • The rows are deleted permanently from the database table in the next database commit. Until that point, they can still be undone using a database rollback
  • The statement DELETE sets a database lock until the next database commit or rollback. If used incorrectly, this can produce a deadlock.
  • The number of rows that can be deleted from the tables of a database within a database LUW is limited, since a database system can only manage a limited amount of locks and data in the rollback area.

Continue

DELETE dbtab - target

DELETE dbtab - cond

DELETE dbtab - source