Subject | Simple but elusive sql deadlock problem |
---|---|
Author | mlq97 |
Post date | 2007-01-26T03:44:31Z |
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^
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^