标签:
SELECT … FOR UPDATE [OF columns]
[WAIT n | NOWAIT];
SELECT * FROM order_master WHERE vencode=‘V002‘ FOR UPDATE OF odate, del_date; UPDATE order_master SET del_date=‘28-8月-05‘ WHERE vencode=’V002’; COMMIT;
SELECT * FROM order_master WHERE vencode=‘V002‘ FOR UPDATE WAIT 5;
SELECT * FROM order_master WHERE vencode=‘V002‘ FOR UPDATE NOWAIT;
使用表级锁使用命令显示地锁定表,应用表级锁的语法是:
LOCK TABLE table_name IN mode MODE;
Lock table emp in row share mode;
Lock table emp in row exclusive mode;
--第一步:用户1 update emp2 set sal=sal+25 where empno=7782; --第二步:用户2 update emp2 set sal=sal+25 where empno=7566; --第三步:用户1 update emp2 set sal=sal+25 where empno=7566; --第四步:用户2 update emp2 set sal=sal+25 where empno=7782; --产生死锁!!Oracle 自动解锁!
标签:
原文地址:http://www.cnblogs.com/hopeblog/p/5003115.html