Subject | Strange errors while creating a trigger |
---|---|
Author | Daniel |
Post date | 2005-02-25T11:11:21Z |
Hi
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).
Secondly why would this "maxLogID = (select gen_id("LogTable_GEN", 0) from
RDB$DATABASE);" not work?
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 ;^
It would be great if anybody could help me.
Regards
Daniel Putra
----------------------------------------------------------------------------
--------------------------------------------------
Should you want to re-create the issue, here are the tables and generator
required:
CREATE TABLE COUNTRY (CID INTEGER NOT NULL, CNAME VARCHAR(20), PRIMARY KEY
(CID));
create table Shadow_COUNTRY (SYNC_ID NUMERIC(18,0) not null, COMMON_ID
NUMERIC(18,0), operationType char(1), STATUS char(1) , CID INTEGER , CNAME
VARCHAR(20) , old_CID INTEGER, SERVER_NAME varchar(250), primary
key(SYNC_ID));
create table LogTable (cid NUMERIC(18,0), Table_Name varchar(32));
CREATE GENERATOR "LogTable_GEN";
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).
Secondly why would this "maxLogID = (select gen_id("LogTable_GEN", 0) from
RDB$DATABASE);" not work?
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 ;^
It would be great if anybody could help me.
Regards
Daniel Putra
----------------------------------------------------------------------------
--------------------------------------------------
Should you want to re-create the issue, here are the tables and generator
required:
CREATE TABLE COUNTRY (CID INTEGER NOT NULL, CNAME VARCHAR(20), PRIMARY KEY
(CID));
create table Shadow_COUNTRY (SYNC_ID NUMERIC(18,0) not null, COMMON_ID
NUMERIC(18,0), operationType char(1), STATUS char(1) , CID INTEGER , CNAME
VARCHAR(20) , old_CID INTEGER, SERVER_NAME varchar(250), primary
key(SYNC_ID));
create table LogTable (cid NUMERIC(18,0), Table_Name varchar(32));
CREATE GENERATOR "LogTable_GEN";