Subject Re: [firebird-support] Help with trigger syntax
Author Mark Rotteveel
On Mon, 31 Oct 2011 15:19:30 -0000, "grip_2ls" <lists@...> wrote:
> 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 ;^

Could you post it with a better formatted version of both the error
message and the query, and indicate what is line 19, column 25?

BTW: It looks like you posted the username and password for the
mailaccount that can be used for bulk-emailing at your ISP. If that is the
case you might want to change the password of account bulk@... before
it gets abused.