Purpose
You can use this statement to lock one or more tables, partitions, or subpartitions in specified mode.
Note
In the current version of OceanBase Database, the LOCK TABLES statement is ignored in MySQL mode.
Applicability
Currently, OceanBase Database Community Edition does not support LOCK TABLES.
Syntax
LOCK TABLES
table_name [ [AS] alias ] lock_type
[, table_name [ [AS] alias ] lock_type ]...
lock_type:
READ [LOCAL]
| [LOW_PRIORTY] WRITE
Parameters
| Parameter | Description |
|---|---|
| table_name | The name of the table to be locked. |
| lock_type | The lock type. The current version of OceanBase Database supports the following lock types:
|
Examples
Set a read lock for the test1 table and a write lock for the test2 table.
obclient> LOCK TABLES test1 as t1 READ LOCAL, test2 as t2 LOW_PRIORITY WRITE;
Query OK, 0 row affected