Subject Re: [IBO] Sequence of changes under transaction
Author Helen Borrie
At 03:29 PM 13/06/2003 +0200, you wrote:
>At 12:55 13.06.2003 +0000, you wrote:
> >Can I trust the sequence of edits and changes done by triggers under
> >transaction control ?

If you can, fire all of the triggers off the same table. You can put one
operation in each before insert or before update of after insert or after
update trigger (as needed) and you can use the POSITION clause of the
CREATE TRIGGER statement to force the triggers to act in a particular order
(starting at POSITION 0).

If you don't sequence multiple triggers within the same timing/operation
group, they will default to Position 0 and fire in an unpredictable order -
probably in the order that were created in or, in a restored database,
possibly in alphabetical order.

And make certain you don't try to perform two updates on the same row
within the same transaction. Apart from being poor from the point of view
of integrity control, it will cause update triggers to fire twice on the
row, with undesirable results. Nota bene, this is also something you must
"code around" if you are using the pessimistic locking feature.

Inside a trigger, the code is structured, so each operation within one
trigger will occur in the coded sequence.

Helen