Subject | Re: Changing Insert to Update. |
---|---|
Author | mmenaz |
Post date | 2002-02-11T00:04:31Z |
I think the only way is doing this using a stored procedure. Pass all the fields you want to insert/update as input parameter of the SP. Inside the SP check the existence of the row, then if false insert, overwise update. I don't know if it's faster try a insert and trap the exception (I never tried that).
Wouldn't be better have something like (client side): after entering the key fields, have a search. If found, show and edit, if not insert (ok, some code to write here ;)). Just an idea.
Regards
Marco Menardi
Wouldn't be better have something like (client side): after entering the key fields, have a search. If found, show and edit, if not insert (ok, some code to write here ;)). Just an idea.
Regards
Marco Menardi
--- In ib-support@y..., "John Peterson" <jcp@i...> wrote:
> Hi All,
> I have a table with a unique constraint. Is there any way in a trigger on
> the table to convert an insert into an Update if the key value already
> exists?
> The idea is to update (the possibly changed) non unique columns, while
> hiding this fact from the (possibly ISQL) user, and keep the client simple,
> and rules in the server.
>
> TIA
> John