Skip to content

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

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 or classic view 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 When the WHERE condition was declared, at least one row was deleted.When a work area in source was declared, the declared row was deleted. Inthe 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 a WHERE condition or a work area in sourcewas declared, no rows were deleted. When an internal table in source wasdeclared, not all of the specified rows 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 current isolation level defines whether the deleted data can be read into other database LUWs before or only after the database commit.
  • 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