Subject Re: [firebird-support] Can't create trigger
Author Martijn Tonies
Hi Rick,

> Never mind. I don't know why it was complaining about the semicolon,
> but I put an empty begin-end block and it accepted that.

Because it has to be SELECT ... FROM ... INTO :something;

:-)

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com

> Without the 'when sqlcode -803' exception handler, Firebird 1.5.1 will
> accept this trigger. Adding the handler gives an 'unknown token ;'
> error.
>
> CREATE TRIGGER DRUGLIST_HISTORY FOR DRUGLIST ACTIVE AFTER UPDATE
> POSITION 0 AS
> begin
> IF (NEW.PRICEACQUISITION<>OLD.PRICEACQUISITION OR
> NEW.ACTIVE_FLAG<>OLD.ACTIVE_FLAG OR NEW.APPLYMARKUP<>OLD.APPLYMARKUP)
> THEN
> BEGIN
> INSERT INTO
> DRUGLISTHISTORY(NDC,SUPPLIERCODE,DISTRB_CTR,ACTIVE_FLAG,PRICEACQUISITION
> ,ACQPRICECHANGED,APPLYMARKUP)
> VALUES
> (OLD.NDC,OLD.SUPPLIERCODE,OLD.DISTRB_CTR,OLD.ACTIVE_FLAG,OLD.PRICEACQUIS
> ITION,OLD.ACQPRICECHANGED,OLD.APPLYMARKUP);
> WHEN SQLCODE -803 DO
> SELECT 1 FROM RDB$DATABASE; /* no-op */
> END
> end