begin works and commit works in storeprocs
Posted in 1997
Topics: General Discussion
I am new to informix .We are working on informix 7.1.
I want to know if I can begin work and commit inside a storeproc.
Before you answer here is the problem.It is in a foreach loop.I
want to process transactions that I get with the foreach select
statement and these transactions is in updates in 5 different places
that must be committed together.If one of these is wrong it must be
rolled back otherwise it must be committed.The problem is it exits out
of
the for each statement as soon as it gets to to 'commit work' statement.
it doesn't process the rest of the transaction
Here is some sample code of what I want to do.
Foreach TxFT For
Select tx.number,tx.amount into nNumber,nAmount
for transactiondt
where txind <> 'E'
begin work; ??????????????????????
let nError = 0; if nAmount = 0 then
nError = 1;
end if;
if nError = 0 then
nError = UpdateBalances(nNumber,nAmount); {call other storeproc}
end if; {that returns
errorcode}
if nError = 0 then
commit work; ?????????????
else
rollback work; ????????????
begin work; ????????????
insert into errordt (txerrornumber,txerrocode)
values(nNumber,nError); commit work; ?????????????????
end if;
end Foreach;
I hope somebody can help me .It is kind of critical.
--
\\\\:// http://www.geocities.com/Area51/9680/
(o -) mailto:rudolph@aqumen.co.za
------------ooO-(_)-Ooo------------------------------------------
.oooO
( ) Oooo. Rudolph Terblanche
-------\\ (----( )----------------------------------------------
\\_) ) /
(_/ A Harmless instrument in the Hands of a Fool,
is DANGEROUS !!!!