Subject Re: [firebird-support] Deadlock
Author Lucas Franzen
Steve,


sgharp schrieb:
> 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.

What do you think is the problem?

>
> 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;

Remove this suspend, what it is good for in your case?

> 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?

Are you sure it is *just* the procedure, there's nothing else (another
update) involved?

Can you execute this procedure on its own?

Is ID your primary key?

Does your procedure spCalc do anything else, or just summing up?


Luc.