UNLOCK TABLE statement
Use the UNLOCK TABLE statement in a database that does not support transaction logging to unlock a table that you previously locked with the LOCK TABLE statement. The UNLOCK TABLE statement is an extension to the ANSI/ISO standard for SQL.
Syntax
Element | Description | Restrictions | Syntax |
---|---|---|---|
synonym | Synonym for a table to unlock | The synonym and the table to which it points must exist | Database Object Name |
table | Table to unlock | Must be in a database without transaction logging, and must be a table that you previously locked | Database Object Name |
Usage
You can lock a table if you own the table or if you have the Select privilege on the table, either from a direct grant to your user ID or from a grant to PUBLIC. You can only unlock a table that you locked. You cannot unlock a table that another process locked. Only one lock can apply to a table at a time.
You must specify the name or synonym of the table that you are unlocking. Do not specify the name of a view, or a synonym for a view.
LOCK TABLE items IN EXCLUSIVE MODE; ... UNLOCK TABLE items; ... LOCK TABLE items IN SHARE MODE;
The UNLOCK TABLE statement fails if it is issued within a transaction. Table locks set within a transaction are released automatically when the transaction completes.
If you are using an ANSI-compliant database, do not issue an UNLOCK TABLE statement. The UNLOCK TABLE statement fails if it is issued within a transaction, and a transaction is always in effect in an ANSI-compliant database.