Subject Re: [firebird-support] Strange errors while creating a trigger
Author Ivan Prenosil
> I want to insert the following trigger into a Firebird 1.5.2 database but
> there are errors.
> Unfortunately the error messages are not clear enough to me (invalid request
> BLR at offset 89).

Probably non-existing generator. Is it really named
"LogTable_GEN"
and not just
LogTable_GEN
?


> Secondly why would this "maxLogID = (select gen_id("LogTable_GEN", 0) from
> RDB$DATABASE);" not work?

Why do you use rdb$database if you do not select any data from it ? This should be enough:
maxLogID = gen_id(LogTable_GEN, 0);

Also, specifying zero step is very suspicious, what are you wanting to achieve ?

Ivan

>
>
> 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 ;^