Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Generate update / Insert scripts
Howard,
I haven't had time to read the 9i doc's yet, but have heard about the
new merge command a couple of times in this newsgroup.
Using the scenario specified below, if there is a record in T2 that is
not in T1, will it be removed from T2?
If you get a chance, let me know. I am just wondering.
Thanks.
Patrick
"Howard J. Rogers" <dba_at_hjrdba.com> wrote in message news:a6umgs$jvd$1_at_lust.ihug.co.nz...
> As ever, no mention of Oracle version.
>
> In 9i, there is the 'merge' SQL command, which will do precisely what you
> want... insert into T2 when there's a record in T1 which can't be found
> already in T2, but update T2 if there is such a matching record. Sometimes
> known as an 'upsert' because of the combination of update and insert
> activity in the one command.
>
> Anything earlier than 9i... you're looking at writing some PL/SQL.
>
> Regards
> HJR
> --
> ----------------------------------------------
> Resources for Oracle: http://www.hjrdba.com
> ===============================
-- Posted via Mailgate.ORG Server - http://www.Mailgate.ORGReceived on Sat Mar 16 2002 - 09:58:06 CST