Subject | Re: [firebird-support] Catching exceptions in trigger |
---|---|
Author | Martijn Tonies |
Post date | 2004-06-17T07:47:18Z |
Hi Gary,
WHEN ALL /* catch all exceptions */
DO ;
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com
> I have a trigger that inserts a value into a log table for replicationAS
> purposes.
>
> CREATE TRIGGER BUTTONS_INSERT FOR BUTTONS ACTIVE AFTER INSERT POSITION 0
> BEGINapplication.
> INSERT INTO CHANGE_LOG( SEQUENCE, TABLENAME, LINK, OPERATION)
> VALUES ( gen_id( change_log, 1), 'BUTTONS', NEW.LINK, 'I');
> END
>
> The table it inserts into has a unique index on the LINK, TABLENAME field,
> so if the record exists I get an unwanted exception error in my
> I dont want the additional overhead in the trigger code of checking ifthe
> record exists before inserting, so my question is:my
> Can I catch this exception 'c-style' inside the trigger and handle it so
> appication doesnt know about itYou can use a WHEN block...
WHEN ALL /* catch all exceptions */
DO ;
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com