community.borland.com

Article #25820: Trigger doesn't fire

Problem:
I have this trigger and it won't fire???

create trigger insert_pk_value for table1 
after insert
as
begin
  new.field1 := gen_id(my_gen, 1);
end!!



Solution:
The information in this article applies to:
* All InterBase versions

The trigger is actually firing.  The problem lies in the trigger
being created as an after insert trigger.

You can't modify values for the new row in AFTER triggers.  To correct
this problem you would need to create this trigger as a BEFORE INSERT
trigger so that the new value can be stored with the new record.

Last Modified: 12-OCT-00