![]() |
|
Use the UNLOCK TABLE statement in a database without transactions to unlock a table that you previously locked with the LOCK TABLE statement. The UNLOCK TABLE statement fails in a database that uses transactions.
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 yourself 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.
The table name either is the name of the table you are unlocking or a synonym for the table. Do not specify a view or a synonym of a view.
To change the lock mode of a table in a database without transactions, use the UNLOCK TABLE statement to unlock the table, then issue a new LOCK TABLE statement. The following example shows how to change the lock mode of a table in a database that was created without transactions:
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.
Related statements: BEGIN WORK, COMMIT WORK, LOCK TABLE, and ROLLBACK WORK
For a discussion of concurrency and locks, see the Informix Guide to SQL: Tutorial.