Files
oceanbase/docs/docs-cn/7.developer-guide-1/2.connect-to-the-oceanbase-database/6.query-table-data/6.use-operators-and-functions-in-queries/10.lock-query-results-select-for-update.md
2022-02-10 14:51:49 +08:00

515 B

锁定查询结果 SELECT FOR UPDATE

OceanBase 支持 MVCC 特性,读是快照读,不阻塞写,是 SELECT 语句还有个特殊的用法可以阻塞写。示例如下:

obclient> select w_name, w_ytd, w_tax from ware where w_id=1 for update;
+------------+---------+--------+
| w_name     | w_ytd   | w_tax  |
+------------+---------+--------+
| n1P4zYo8OH | 1200.00 | 0.1868 |
+------------+---------+--------+
1 row in set (0.01 sec)