1、全表排他锁:
select * from employees for update;
2、选定行排他锁:
select * from employees where employees=100 for update;
3、两个表链接,只锁一个表的选定行:
select * from employees e,departments d where e.department_id=d.department_id and e.employee_id=100 for update of e.employee_id;
4、采用排他锁时选择不等待(这个表被别人占用时立马报错,结束等待):
select * from employees for update nowait;
5、采用排他锁时,指定等待多少秒:
单位默认为:秒
select * from employees where employee_id=100 wait 5;
原文地址:https://www.cnblogs.com/CL-learning/p/11294405.html
时间: 2024-10-11 04:11:52