Difference between revisions of "LOCK TABLE"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
|||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Locks a table to control access by other processes | Locks a table to control access by other processes | ||
− | |||
==Syntax== | ==Syntax== | ||
LOCK TABLE [<database>!]<table> IN SHARE | EXCLUSIVE MODE [NOWAIT] | LOCK TABLE [<database>!]<table> IN SHARE | EXCLUSIVE MODE [NOWAIT] | ||
− | |||
==See Also== | ==See Also== | ||
[[COPY DATABASE]], [[CREATE DATABASE]], [[DISPLAY SCHEMAS]], [[SQL INSERT|INSERT]], [[LIST SCHEMAS]], [[OPEN DATABASE]], [[SQL SELECT|SELECT]], [[SET AUTOCATALOG]], [[SQL UPDATE|UPDATE]], [[SQL USE|USE]] | [[COPY DATABASE]], [[CREATE DATABASE]], [[DISPLAY SCHEMAS]], [[SQL INSERT|INSERT]], [[LIST SCHEMAS]], [[OPEN DATABASE]], [[SQL SELECT|SELECT]], [[SET AUTOCATALOG]], [[SQL UPDATE|UPDATE]], [[SQL USE|USE]] | ||
− | |||
==Description== | ==Description== | ||
To lock tables to control access by other processes. The LOCK TABLE statement locks an entire table to restrict access by other users or transactions. There are no prerequisites required to perform this operation. | To lock tables to control access by other processes. The LOCK TABLE statement locks an entire table to restrict access by other users or transactions. There are no prerequisites required to perform this operation. | ||
− | + | {| class="wikitable" width="100%" | |
− | {| class="wikitable" | + | !width="20%"|Keywords||Description |
− | !Keywords||Description | + | |
|- | |- | ||
− | |database||The name of the database to which the table belongs | + | |valign="top"|database||The name of the database to which the table belongs. The '!' character must be included between the database name and the table name. |
|- | |- | ||
|table||The name of the table to set the lock mode on. | |table||The name of the table to set the lock mode on. | ||
|- | |- | ||
− | |SHARE||Share locks allow queries on locked tables, but prevent updates. | + | |valign="top"|SHARE||Share locks allow queries on locked tables, but prevent updates. |
|- | |- | ||
|EXCLUSIVE||This lock denies access by any other process to the table | |EXCLUSIVE||This lock denies access by any other process to the table | ||
|- | |- | ||
− | |NOWAIT||This specifies that if a lock cannot be granted immediately during an update, then an error should be returned. | + | |valign="top"|NOWAIT||This specifies that if a lock cannot be granted immediately during an update, then an error should be returned. |
|- | |- | ||
|} | |} | ||
− | |||
==Example== | ==Example== | ||
Line 35: | Line 30: | ||
LOCK TABLE staff IN SHARE MODE | LOCK TABLE staff IN SHARE MODE | ||
</code> | </code> | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:SQL]] | [[Category:SQL]] | ||
[[Category:Commands]] | [[Category:Commands]] | ||
− | [[Category: | + | [[Category:Cursor Functions]] |
[[Category:Databases]] | [[Category:Databases]] |
Latest revision as of 07:48, 4 February 2013
Contents
Purpose
Locks a table to control access by other processes
Syntax
LOCK TABLE [<database>!]<table> IN SHARE | EXCLUSIVE MODE [NOWAIT]
See Also
COPY DATABASE, CREATE DATABASE, DISPLAY SCHEMAS, INSERT, LIST SCHEMAS, OPEN DATABASE, SELECT, SET AUTOCATALOG, UPDATE, USE
Description
To lock tables to control access by other processes. The LOCK TABLE statement locks an entire table to restrict access by other users or transactions. There are no prerequisites required to perform this operation.
Keywords | Description |
---|---|
database | The name of the database to which the table belongs. The '!' character must be included between the database name and the table name. |
table | The name of the table to set the lock mode on. |
SHARE | Share locks allow queries on locked tables, but prevent updates. |
EXCLUSIVE | This lock denies access by any other process to the table |
NOWAIT | This specifies that if a lock cannot be granted immediately during an update, then an error should be returned. |
Example
LOCK TABLE staff IN SHARE MODE