I have a proc which has update query which is getting invoked in parallel. I have used Sybase select for update command to select set of rows so that transaction who has picked up these set of record should be responsible for updating and no other transaction should select and update the same record. But after using select for update I am getting following error:
"Your server command (family id #0, process id #416) encountered a deadlock situation. Please re-run your command."
Basically I am trying to invoke proc in parallel thread and one of thread is able to perform the update query and rest all thread fail giving above exception. Here is code snippet
begin transaction declare x cursor for select a from B where c=1 for update of p open x fetch x into @N while(@@sqlstatus != 2) begin update B set p=1 where a [email protected]N end commit transaction