select for update
来源:互联网 发布:在淘宝上开店货源怎么办 编辑:程序博客网 时间:2024/06/05 10:38
select * from TTable1 for update 锁定表的所有行,只能读不能写
select * from TTable1 where pkid = 1 for update 只锁定pkid=1的行
select * from TTable1 where pkid = 1 for update 只锁定pkid=1的行
select * from Table1 a join Table2 b on a.pkid=b.pkid for update 锁定俩表的符合id匹配条件的所有记录
select * from Table1 a join Table2 b on a.pkid=b.pkid where a.pkid = 10 for update 锁定两个表的中满足条件的行
select * from Table1 a join Table2 b on a.pkid=b.pkid where a.pkid = 10 for update of a.pkid 只锁定Table1中满足条件的行
for update of ,根据oracle文档,它是用来锁字段的。
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10826/pco03dbc.htm#i4233
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10826/pco03dbc.htm#i4233
-------------------------------------测试例子--------------------------------------------------------------
BEGIN;
SELECT * FROM test where id =2 FOR UPDATE;
SELECT * FROM test where id =2 FOR UPDATE;
----在提交之前如果(UPDATE test set xx = xx WHERE id =2),则会一直等待。知道commit (解锁)之后再执行。其他id 如3 等 则不受影响
COMMIT;
COMMIT;
阅读全文
0 0
- select ... for update, select ... for update nowait
- select for update行锁
- oracle select ... for update
- SELECT FOR UPDATE
- select for update行锁
- select for update
- select for update
- select ...for update
- SELECT ... FOR UPDATE
- select for update
- Select for Update
- select ... for update
- SELECT FOR UPDATE
- select ... for update
- SELECT FOR UPDATE
- select for update
- SELECT FOR UPDATE
- select *** for update
- Java中的线程Thread方法之---interrupt()
- 解题常用工具
- 查询每个班成绩排名前三的学生信息
- QQ红包随机数算法
- Linux(CentOS)下设置nginx开机自动启动和chkconfig管理
- select for update
- Linux+Apache+Mysql+PHP优化技巧
- 页面表格
- (41)异常编程练习:①搜索一个字符数组中是否存在某个字符②判断哪个圆半径大,返回值是圆
- USACO-Section1.5 sprime[深搜]
- css3 pipe
- Mysql学习历程(16)-数据备份与还原
- Dubbo性能优化
- Linux下文件操作,打开一个文件并修改文件后5个字符为abcde