另外,“select for update当对话使用for update子串打开一个游标时,所有返回集中的数据行都将处于行级(Row-X)独占式锁定,其他对象只能查询这些数据行,不能进行update、delete或select for update操作。”但我试过,使用select for update若加上where条件的话,可以设置查询出的若干行进行锁定,此时delete不行,但可以insert啊,怎么解释?
请问: 1、使用select ... where ... for update时,可以同时进行insert操作么? 2、使用select ... where ... for update,只有执行commit后,才能继续使用select ... where ... for update执行?如果同时有两条:select ... where ... for update,那肯定只有一条在执行,当commit后,另外一条才能继续执行?
您的意思是如果insert的数据在for update where的条件内,则需要被hold?
有高手可否告知重建索引时是否会产生SQL错误返回值呢?是多少呢?
RS: row share
RX: row exclusive
S: share
SRX: share row exclusive
X: exclusive 其中S,SRX,X基本都需要显示调用LOCK TABLE来完成,而RS和RX是自动的,RS模式在Select for update时会启用,这种模式保证当另外一个transaction对表进行操作时,只能获得RS,RX,S和SRX模式的锁,而无法获得X模式的锁,而当调用insert,update和delete时,将获得RX模式的锁,在这种模式下,另一个transaction将只能获得这张表上的RS,RX模式的锁,而无法获得S,SRX和X模式的锁
Oralce表锁有五种,分别是:
RS: row share
RX: row exclusive
S: share
SRX: share row exclusive
X: exclusive 其中S,SRX,X基本都需要显示调用LOCK TABLE来完成,而RS和RX是自动的,RS模式在Select for update时会启用,这种模式保证当另外一个transaction对表进行操作时,只能获得RS,RX,S和SRX模式的锁,而无法获得X模式的锁,而当调用insert,update和delete时,将获得RX模式的锁,在这种模式下,另一个transaction将只能获得这张表上的RS,RX模式的锁,而无法获得S,SRX和X模式的锁
1、使用select ... where ... for update时,可以同时进行insert操作么?
2、使用select ... where ... for update,只有执行commit后,才能继续使用select ... where ... for update执行?如果同时有两条:select ... where ... for update,那肯定只有一条在执行,当commit后,另外一条才能继续执行?