Subject | Can't create trigger |
---|---|
Author | Rick DeBay |
Post date | 2004-09-17T14:32:59Z |
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
Rick DeBay
Senior Software Developer
RxStrategies.net
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
Rick DeBay
Senior Software Developer
RxStrategies.net