Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Generate update / Insert scripts

Re: Generate update / Insert scripts

From: Patrick Meyer <buckeye234_at_excite.com>
Date: Sat, 16 Mar 2002 15:58:06 +0000 (UTC)
Message-ID: <89782b7c5c66013354991b5ac1d9e8c5.61632@mygate.mailgate.org>


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.ORG
Received on Sat Mar 16 2002 - 09:58:06 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US