Subject | Re: [firebird-support] exception handling in triggers |
---|---|
Author | Ann W. Harrison |
Post date | 2006-07-14T15:30:53Z |
Radu Sky wrote:
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
>No, the exception handling in triggers is only for errors caused
> 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
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