Subject Re: [ib-support] old and new variables in sequential triggers
Author Andrew Guts
As I know triggers always work in transaction context (implicit or
explicit ). What is why OLD contains values before any changes.

Andrew

Gerhardus Geldenhuis wrote:

>Hi
>I did an experiment on old and new values in triggers and I just want to
>know if my "findings" is correct.
>
>I have written two before update triggers one with position 1 and the
>other with position 2.
>
>My start field value is 1.
>the trigger code is
>
>The value I typed was 30.
>
>if (new.k3=10) then
> new.k3=20
>
>I write the old and new variable values in the second trigger to a table.
>
>The second triggers old value was 1 and the new value was 20.
>
>My deduction is that the old value for triggers following each other
>will always be the value it was before the first trigger fired and
>
>the new value will be whatever it is changed to in the previous trigger.
>
>Also the old value for after update will be the value before any trigger
>was fired and the new value for after update will whatever it was
>changed to in the last after update trigger that edited the new
>variable, with the difference that this value will not write back to the
>table.
>
>Groete
>Gerhardus
>
>
>