Subject Re: [firebird-support] exception handling in triggers
Author Ann W. Harrison
Radu Sky wrote:
>
> I thought in the beginning that I could capture the -803 sqlcode in the
> before insert/update trigger and change the value, eventually throw some
> custom exception

No, the exception handling in triggers is only for errors caused
by code in the trigger. It won't catch errors in the triggering
operation. What you need to do is check for duplicates in the
trigger.

create triggers checker before insert
as begin
for select first 1 i.invoiceno from invoices i
where i.inoviceno = new.invoiceno
do begin
set new.invoiceno = null;
end
end

Regards,


Ann