User Guide
SAP AG November 2002
Once a shared lock is assigned to a for a particular data object,
concurrent transactions can access the object but not modify it. Other transactions can set a
shared lock, but not an for this object.
transaction [Page 152]
exclusive lock [Page 115]
Shared locks refer to a row or a table.
See also:
Requesting and Releasing a Lock [Page
115]
Exclusive Lock
One type of 140 is the exclusive lock. lock [Page ]
Once an exclusive lock is assigned to a transaction [Page
152] for a particular data object,
other transactions cannot modify this object. Transactions that use exclusive locks, check for
the existence of exclusive locks, or want to set
are not able to
access the locked object.
shared locks [Page
114]
Exclusive locks refer to a row or a table.
See also:
Requesting and Releasing a Lock [Page
115]
Optimistic Lock
One type of is the optimistic lock at row level. It only makes sense to use an
optimistic lock if one of the , 117 or
118 was assigned. An optimistic row lock must be explicitly requested by specifying a
.
lock [Page 140]
isolation levels [Page 139] 0 [Page 117] 1 or 10 [Page ] 15
[Page ]
LOCK statement [See SAP DB Library]
An update operation performed by the current user on a row that the user set an optimistic
lock on is only actually carried out if this row has not been changed in the meantime by a
concurrent
. If this row has been changed in the meantime by a
concurrent transaction, the update operation of the current user is rejected.
transaction [Page
152]
The optimistic lock is released in both cases.
• If the update operation was successful, an exclusive lock [Page
115] is set for this row.
• If the update operation was not successful, it should be repeated after reading the row
again with or without optimistic lock. In isolation level 0, an explicit lock must be specified
for the new read operation. In this way, it can be ensured that the update is done to the
current state and that no modifications made in the meantime are lost.
The request of an optimistic lock only collides with an exclusive lock. Concurrent transactions
do not collide with an optimistic lock.
Requesting and Releasing a Lock
To control , you can request and release . lock behavior [Page 113] locks [Page 140]
Depending on the lock mode selected, locks can be requested and released implicitly or
explicitly.
User Manual: SAP DB 115










