Subject Re: [ib-support] Re: Changing Insert to Update.
Author Claudio Valderrama C.
""John Peterson"" <jcp@...> wrote in message
news:01dd01c1b2ae$da26e400$326410ac@gw5300...
> Thanks Helen,
> Your response answers my question (which I didn't actually ask :(( ).
That
> being....Will the Insert error occur in the Before Insert Trigger? Your
> solution would indicate that it does.

I don't think the tale is so simple.
Create a view.
Make sure the view is non-updatable (see Langref)
Create a before insert trigger for the view. Triggers on view can change the
semantics. Triggers on tables can't change the semantics of the original
operation.
The trigger tries to insert into the base table. Failing that (use WHEN),
the trigger tries to update a record. Do not trap a possible update error in
the trigger as it's possible that your update causes conflict with another
user and the non-trapped error goes back to the client; otherwise you don't
notice the failure.

C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing