Subject Deadlock
Author sgharp
Hi All,

I have the following stored procedure that is failing with a
deadlock. I think I know why it's failing but I don't know how to
resolve it.

create procedure spCalcPrice
as
declare variable iID Integer;
declare variable dPrice Double Precision;
begin
for select ID
from mytable
order by ID
into :iID
do
Begin
execute procedure spCacl(:iID) returning_values :dPrice;

update mytable
set Price = :dPrice
where (ID = :iID);
End

suspend;
end

I'm getting a message, "deadlock. update conflicts with concurrent
update." and the price is not being updated. How can I structure
this to resolve this error?

Thanks,
Steve