Subject | Help with trigger syntax |
---|---|
Author | grip_2ls |
Post date | 2011-10-31T15:19:30Z |
Once again I am struggling with the syntax of a trigger. When I run the
following I get the error:
Error at line 3: Dynamic SQL ErrorSQL error code = -104Token unknown -
line 19, column 25;
There isn't even a semi-colon on line 19!
Any advice gratefully received.
Neil
SET TERM ^ ;
/* Triggers only will work for SQL triggers */
CREATE TRIGGER TRGAIBOOKING_STAGE_HISTORY FOR
BOOKING_STAGE_HISTORYACTIVE AFTER INSERT POSITION 0AS
DECLARE EMAIL VARCHAR(255); DECLARE DESCRIPTION VARCHAR(50);
BEGIN SELECT BST.EMAIL, BST.DESCRIPTION FROM BOOKING_STAGE BST WHERE
BST.ID = NEW.STAGEID INTO :email, :description;
SELECT SendMail('alerts@...', :email,
'Change of status for booking '||NEW.BOOKINGID,
'Just to let you know that booking '||NEW.BOOKINGID||' has now reached
stage '||:description, 'auth.smtp.1and1.co.uk',
'25', 'bulk@...',
'8Burgess') FROM rdb$database;
END ^
COMMIT WORK ^SET TERM ;^
[Non-text portions of this message have been removed]
following I get the error:
Error at line 3: Dynamic SQL ErrorSQL error code = -104Token unknown -
line 19, column 25;
There isn't even a semi-colon on line 19!
Any advice gratefully received.
Neil
SET TERM ^ ;
/* Triggers only will work for SQL triggers */
CREATE TRIGGER TRGAIBOOKING_STAGE_HISTORY FOR
BOOKING_STAGE_HISTORYACTIVE AFTER INSERT POSITION 0AS
DECLARE EMAIL VARCHAR(255); DECLARE DESCRIPTION VARCHAR(50);
BEGIN SELECT BST.EMAIL, BST.DESCRIPTION FROM BOOKING_STAGE BST WHERE
BST.ID = NEW.STAGEID INTO :email, :description;
SELECT SendMail('alerts@...', :email,
'Change of status for booking '||NEW.BOOKINGID,
'Just to let you know that booking '||NEW.BOOKINGID||' has now reached
stage '||:description, 'auth.smtp.1and1.co.uk',
'25', 'bulk@...',
'8Burgess') FROM rdb$database;
END ^
COMMIT WORK ^SET TERM ;^
[Non-text portions of this message have been removed]