Subject Re: [firebird-support] Strange errors while creating a trigger
Author Ivan Prenosil
> SET TERM ^ ;
> create trigger TRU_country FOR country ACTIVE AFTER UPDATE AS
> declare variable maxLogID NUMERIC(18,0);
> begin
> insert into LogTable ( table_name ) values ( 'country');
> maxLogID = (select gen_id("LogTable_GEN", 0) from RDB$DATABASE);
> insert into Shadow_country ( common_id, operationType, status, CID, CNAME,
> old_CID, server_name ) values (:maxLogID, 'U', 'B', old.CID, old.CNAME,
> old.CID, 'server2_3001');
> insert into Shadow_country ( common_id, operationType, status, CID, CNAME,
> old_CID, server_name ) values (:maxLogID, 'U', 'A', new.CID, new.CNAME,
> old.CID, 'server2_3001');
> end ^
> SET TERM ;^

You can also decrease amount of data stored into Shadow_country table
by logging just old values, because the new values are stored in Country table.

Ivan