Read records with NO-LOCK
- Last Updated: April 22, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
If you want to read records regardless of whether they
are locked by other users, you can use a third NO-LOCK option.
This option lets you read a record without ever being prevented
from doing so by another user's lock. If you do not intend to update
the record and are simply reading the data, this is an appropriate
option. You must always be aware that reading records with NO-LOCK means
that you might read parts of an incomplete transaction that has
written some but not all of its changes to the database. In some
cases, you can even read a record that has been newly written to
the database with its key fields and index information, but not with
the changes to other fields in the record. NO-LOCK is the
default locking level for queries that have an associated browse,
since you would normally not want to lock a whole set of records
simply to browse them.
You cannot upgrade a record's lock level from NO-LOCK to EXCLUSIVE-LOCK. If you try to update a
record you read with NO-LOCK, you get an error message from
the AVM, such as the one shown in the following figure.
You must FIND the record again with an EXCLUSIVE-LOCK if
you need to update it.