Subject Re: [firebird-support] New context in After trigger
Author Martijn Tonies
Hello Eric,

> This code does not work anymore in 2.1. In 1.5 without problems (now
> commented, calculating amounts in app.)
>
>
> BEGIN
>
> -- SELECT DISTINCT POS.BTWPERCENTAGE FROM POS into :FPBTW;
>
> -- New.BedragExcl = ((New.BedragIncl / (100 + :FPBTW)) * 100);

Right, this obviously fails in an AFTER trigger. Remember, an AFTER triggers
works after the data has been stored, so you can never adjust a value in the
table via the NEW-context.

Can't this be done in a BEFORE trigger?

Or how about a COMPUTED BY value that's never stored?

> END;

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com