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: Howard J. Rogers <dba_at_hjrdba.com>
Date: Sun, 17 Mar 2002 06:46:06 +1100
Message-ID: <a707et$v4k$1@lust.ihug.co.nz>


No. It does an update or an insert, but not a delete. So if there is a record in T2 that is not in T1, it will be inserted into T1.

Regards
HJR

--
----------------------------------------------
Resources for Oracle: http://www.hjrdba.com
===============================


"Patrick Meyer" <buckeye234_at_excite.com> wrote in message
news:89782b7c5c66013354991b5ac1d9e8c5.61632_at_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 - 13:46:06 CST

Original text of this message

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