Subject Re: [ib-support] Setting field values within a trigger
Author Svein Erling Tysvaer
Hello Dan,

you do not say which kind of trigger you are referring to. In general, what
you are doing should work in a BEFORE INSERT trigger, but not in a AFTER
INSERT trigger (before insert is for updating the same record as you are
inserting, after insert for updating other tables).

That being said, to get this new value back to the client is a different
thing (e.g. if you do inserts in your program and expects to see the result
afterwards). The trigger executes on the server and to get the new value to
your client you have to refetch the record in one way or another.

HTH,
Set

At 12:10 06.06.2003 +0000, you wrote:
>Good Morning!
>
> I have Firebird 1.0.0.796.
>
> I am trying to set some fields in a table based on variable
>results from within the tables insert trigger.
>
> I am looking up and or calculating some variables. Then, I am
>using "New.TotQtyBefore=:Total_Before" (and other fields the same
>way) but the field is comming up null. I have a "if (new.TotQtyBefore
>is null) then new.TotQtyBefore =0" but it did not help.
>
> How do I set a fields value from within an insert trigger?
>
> Ther is no unique index field on the table. (Bummer!)
>
>Thanks...Dan'l