我在Sybase有一个程序,其编号如下。
begin transaction get_virtual_acc
UPDATE store_virtual_acc SET isProc = 1, Uid = @uid, DateReserv = getdate()
from store_virtual_acc (index idx_id) WHERE id = (SELECT min(id) FROM store_virtual_acc (index idx_uid) where Uid = null and isProc = null)
commit transaction get_virtual_acc
问题在于,当程序被称作多个用户时,他们可以接受同样的(d)项,并在表格中更新具有不同价值的同一行文。 结果是数据被歪曲。 要取得结果,就必须选择一条线路更新单一用户,另一条可以选择。 表有24个数据流。
Tried to use a transaction-level locking as follows set transaction isolation level 3 before the transaction begin but aplication wich call the procedure get exception java.sql.SQLException: Your server command (family id # 0, process id # 530) encountered a deadlock situation. Please re-run your command.
我感谢任何帮助。