but the custTable has accountNum as a unique index so when 6 users click it at the same time, that means all the 6 users will try to take the same account Number. So isn't the logical output to be that one user will insert successfully and the others will get that the record already exists?
and the answer to my question when we get such errors, how can we handle them in code so that they won't appear to the user. I mean the code should make the others wait then proceed, isn't that doable?
One more thing, i tried to reproduce the issue but i got no errors: Am i not locking the same record in the code below?
try
{
ttsbegin;
while select forupdate custtable1 where custtable1.accountnum = "1"
{
select forupdate custtable2 where custtable2.accountNum ="1"
custtable2.update();
custtable1.update();
}
ttscommit;
}
catch
{
}
plus what is the difference between update conflicts and deadlock?