Subject | Re: Simple but elusive sql deadlock problem |
---|---|
Author | Svein Erling Tysvær |
Post date | 2007-01-26T08:18:50Z |
Not quite answering your question, but what happens if you do
UPDATE ITEM I
SET I.item_act_markup = COALESCE(I.item_markup_overide,
(SELECT P.pdmups_markup FROM projdefmarkups P
WHERE i.pdmups_id = p.pdmups_id))
HTH,
Set
-happy to be a Firebird Foundation member
(www.firebirdsql.org/index.php?op=ffoundation)
UPDATE ITEM I
SET I.item_act_markup = COALESCE(I.item_markup_overide,
(SELECT P.pdmups_markup FROM projdefmarkups P
WHERE i.pdmups_id = p.pdmups_id))
HTH,
Set
-happy to be a Firebird Foundation member
(www.firebirdsql.org/index.php?op=ffoundation)
--- In firebird-support@yahoogroups.com, Mitch wrote:
>
> Could some kind soul please point out where I am going wrong with
> this?
>
> I want to cycle through each record and update a value in the row.
> When I debug this the problem is clearly with the UPDATE statement,
> but I just can't figure out what I'm doing wrong.
>
> Many thanks
>
> Mitch
>
>
> CREATE PROCEDURE CALC_ACT_MARKUP
> AS
> DECLARE VARIABLE itemid INTEGER;
> DECLARE VARIABLE act_markup FLOAT;
> DECLARE VARIABLE markup_override FLOAT;
> DECLARE VARIABLE markup_default FLOAT;
> begin
>
> FOR SELECT projdefmarkups.pdmups_markup, item.item_markup_overide,
> item.item_id
> FROM item
> INNER JOIN projdefmarkups ON (item.pdmups_id =
> projdefmarkups.pdmups_id)
> INTO :markup_default, :markup_override, :itemid
> DO
> BEGIN
> if (:markup_override is not null) then
> act_markup = :markup_override;
> else
> if (:markup_default is not null) then
> act_markup = :markup_default;
> else
> act_markup = NULL;
>
> UPDATE ITEM set item_act_markup = :act_markup
> where item.item_id = :itemid
> ;
>
> END
> end^