Subject | RE: [firebird-support] Can't create trigger |
---|---|
Author | Rick DeBay |
Post date | 2004-09-17T14:39:44Z |
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.
-----Original Message-----
From: Rick DeBay
Sent: Friday, September 17, 2004 10:33 AM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Can't create trigger
Importance: High
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
Yahoo! Groups Links
but I put an empty begin-end block and it accepted that.
-----Original Message-----
From: Rick DeBay
Sent: Friday, September 17, 2004 10:33 AM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Can't create trigger
Importance: High
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
Yahoo! Groups Links