English 中文(简体)
在更新Sybase表格时正式同意
原标题:Resolve concurency during updating table in Sybase

我在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.

我感谢任何帮助。

最佳回答

类似情况:

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) holdlock where  Uid = null and isProc = null )  

commit transaction get_virtual_acc 

关键词是holdlock

问题回答

暂无回答




相关问题
Access Database Pass Through Query?

I have linked Sybase database table with Access 2003. I only have read access to the Sybase database and created a pass-through query in access. Now what I need is, I need to create a temp table in ...

Can I trace database s records by SQL query from log file?

I need to trace changes on a record in database. I have some triggers on different tables that calls one stored procedure and this sp updates records in certain table (table1). I will trace records ...

How *does* Powerbuilder POST work?

Unfortunately searching for Sybase Post doesn t get me the answers I m looking for. I want to know what the actual function is of POST As in .. procedure lala POST procedure1() procedure2() I m ...

Full table scan occured even when index exists?

We have a sql query as follows select * from Table where date < 20091010 However when we look at the query plan, we see The type of query is SELECT. FROM TABLE Worktable1. ...

Sybase Development IDE

Is there a Toad type application for Sybase? I can t seem to find a single one! I ve tried using VS 2008 but can t see the sproc source.

热门标签