Subject | a error of too many concurrent execution of the same request |
---|---|
Author | ibmcom2011 |
Post date | 2011-11-28T14:24:04Z |
Hi,
I try to update a column value in a trigger after updating a row, but it raises
a error of too many concurrent execution of the same request.
I know this is caused by recursion, but I can't avoid it.
I want update a column value of all the rows which is after the updating rows.
ID ---------- Num1 ---------- Num2 --------- YE
1 ---------- 15 ---------- 25 ---------- 28
2 .......
3 .......-----------------------------------32
4 ------------20 ----------- 35 -----------27 ---> 32+20-35 =27
5
6
7
if in row 4, then num1 or num2 is changed, then for the rows 4 to 7,
the columns YE will be changed followed.
---------------------------------------------------------------------
The trigger is like this:
declare variable nID integer;
declare variable maxid integer;
if (updating or (deleting) ) then
begin
select max(f_acd_id) from table1 into :maxID;
nid = old.f_acd_id;
while (nid < :maxid) do
begin
select first 1 balance from table1 where f_acd_id < :nid
order by f_acd_id desc
into :ye;
update table1
set balance = :ye + new.num1 - new.num2
where f_acd_id = :nid;
nid = :nid + 1;
end
end
Looking forward to your help, thanks.
I try to update a column value in a trigger after updating a row, but it raises
a error of too many concurrent execution of the same request.
I know this is caused by recursion, but I can't avoid it.
I want update a column value of all the rows which is after the updating rows.
ID ---------- Num1 ---------- Num2 --------- YE
1 ---------- 15 ---------- 25 ---------- 28
2 .......
3 .......-----------------------------------32
4 ------------20 ----------- 35 -----------27 ---> 32+20-35 =27
5
6
7
if in row 4, then num1 or num2 is changed, then for the rows 4 to 7,
the columns YE will be changed followed.
---------------------------------------------------------------------
The trigger is like this:
declare variable nID integer;
declare variable maxid integer;
if (updating or (deleting) ) then
begin
select max(f_acd_id) from table1 into :maxID;
nid = old.f_acd_id;
while (nid < :maxid) do
begin
select first 1 balance from table1 where f_acd_id < :nid
order by f_acd_id desc
into :ye;
update table1
set balance = :ye + new.num1 - new.num2
where f_acd_id = :nid;
nid = :nid + 1;
end
end
Looking forward to your help, thanks.