UPDATE target [connection] source.
The ABAP SQL statement
UPDATE changes the content of one or more rows of the database table specified in
target. The entries in
source determine which columns of which rows are changed, and how they are changed.
connection can be used to specify a
SET was specified in
source, at leastone row was changed. When a work area was specified in
source, the specifiedrow was changed. When an internal table was specified in
source, all specified rows were changed or the internal table is empty.
|If a LOB handle structure with a component forwriter streams or a referencevariable for writer streams was specified after
SET, the components whichare not associated with writer streams were not yet written to the database, but instead are passedwhen the stream is closed at latest. Whether this situation occurs or not depends on the database. See LOB handles.
SET or a work area was specified in
source,no row was changed; or when an internal table was specified in
source, notall specified rows were changed. This is either because no appropriate row was found, or because the change would created a row that produces duplicate entries in theprimary key or a uniquesecondary index in the database table.
sy-dbcnt to the number
of changed rows. If an overflow occurs because the number or rows is greater than 2,147,483,647,
sy-dbcnt is set to -1. If
sy-subrc is 2,
sy-dbcnt is also set to the value -1 (for undefined).
- The changes are committed to the database by the next database commit. Until that point, they can still be undone using a database rollback The current isolation level defines whether the modified data can be read into other database LUWs before or only after the database commit.
UPDATEsets a database lock as an exclusive lock until the next database commit or rollback. If used incorrectly, this can produce a deadlock.
- The number of rows that can be modified in 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.
UPDATEcannot be applied to the system table TRDIR.
UPDATE overwrites the content of the columns of a database
table row specified by a key with values from a work area created using the value operator
DELETE FROM demo_update.
INSERT demo_update FROM @( VALUE #( id = 'X' ) ).
UPDATE demo_update FROM @( VALUE #( id = 'X' col1 = 100
col2 = 200
col3 = 300
col4 = 400 ) ).