比如说有2个拥护A,B 和 stu表(stuID,stuName)(2个用户都可以对表进行DML操作) -------------------------------------------- 用户A琐定stu表中stuID为1的信息 select * from stu where stuid='1' for update ; -------------------------------------------- 用户B琐定stu表中stuID为2的信息 select * from stu where stuid='2' for update ; -------------------------------------------- 用户A执行update stu set stuName='aa' where stuID='2'; 这样会被琐住; -------------------------------------------- 而用户B执行update stu set stuName='aa' where stuID='1'; 也都会被同样琐住。 ------------------- 这样2个用户都不能操作了。 之后死琐。------- 小弟我是这样认为的。 不同意见可以交流
然后再相互试着update对方holder着的.
update without commit;
--------------------------------------------
用户A琐定stu表中stuID为1的信息
select * from stu where stuid='1' for update ;
--------------------------------------------
用户B琐定stu表中stuID为2的信息
select * from stu where stuid='2' for update ;
--------------------------------------------
用户A执行update stu set stuName='aa' where stuID='2';
这样会被琐住;
--------------------------------------------
而用户B执行update stu set stuName='aa' where stuID='1';
也都会被同样琐住。
-------------------
这样2个用户都不能操作了。
之后死琐。-------
小弟我是这样认为的。
不同意见可以交流