LOCK TABLE
The LOCK TABLE statement either prevents concurrent
application processes from changing a table or prevents concurrent
application processes from using a table.
You can lock a table:
- IN SHARE MODE - Acquires a shared lock (*SHRNUP) for the application process in which the statement is executed. Until the
lock is released, it prevents concurrent application processes from executing any but read-only operations on
the table. Other application processes may also acquire a shared lock (*SHRNUP) and prevent this
application process from executing any but read-only operations.
- IN EXCLUSIVE MODE ALLOW READ - Acquires an exclusive allow read lock (*EXCLRD) for the application process in which the statement is
executed. Until the lock is released, it prevents concurrent application processes from executing any but
read-only operations on the table. Other application processes may not acquire a shared lock (*SHRNUP)
and cannot prevent this application process from executing updates, deletes, and inserts on the table.
- IN EXCLUSIVE MODE - Acquires an exclusive lock
(*EXCL) for the application process in which the statement is executed. Until
the lock is released, it prevents concurrent application processes from
executing any operations at all on the table.
Example:
Obtain a lock on the DEPARTMENT table. Do not allow others to either update or read from
DEPARTMENT while it is locked.
LOCK TABLE DEPARTMENT IN EXCLUSIVE MODE
For more information, see LOCK TABLE in the SQL Reference topic in the
Information Center
.