Subject transaction again
Author Olaf Kluge
Hello,



Maybe you can help me again.



In this case, with a stored procedure I create a record on table a, a record
in table b with reference key depended from table a and a record in table c
with references too. Now, in the first table a trigger starts a procedure
after insert of data.



Apparently, all records are not inserted at the same time with one
transaction. The trigger in table 1 runs, before the record in table 2 is
inserted. I can help me with a status in table 1 and set its after I have
inserted the other records.



Is there possible another solution?



Thank you.



Here the code of the stored procedure



CREATE OR ALTER PROCEDURE TMP_SET_IMPORTTABLES

RETURNS (

IO INTEGER)

AS

declare variable tmp integer;

declare variable ic40 char(40);

declare variable ivc40 varchar(40);

BEGIN

insert into idoc(idoctypid, state, errorcode, source, destination) values

(11, 10, 0, 1, 2) returning lineid into :io;

insert into h2orderm(idocid, modcnt, datacode, bookctrl, corderid,
corderty, cprio, cwsid)

values (:io, 0, 10, 10, 'BNR999', 'A', 5, 1);

insert into h2orderd(idocid, modcnt, datacode, corderid, corderty,
corderln, cpartid,

cqnominal, cbu, clotid, cspecinvid, corderinfo1) values

(:io, 0, 40, 'BNR999', 'A', 1, 'Olaf', '100555', 'KG', 'Charge1',
'SpezialNR1', 'infoinfo');

insert into h2orderd(idocid, modcnt, datacode, corderid, corderty,
corderln, cpartid,

cqnominal, cbu, clotid, cspecinvid, corderinfo1) values

(:io, 0, 40, 'BNR999', 'A', 2, 'Bernd', '100999', 'KG', 'Charge2',
'SpezialNR2', 'info111info');

suspend;

END



[Non-text portions of this message have been removed]