Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Generate update / Insert scripts
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 =============================== "Sunil" <sunil_franklin_at_hotmail.com> wrote in message news:ftAk8.7$ht6.87_at_inet-nntp1.oracle.com...Received on Fri Mar 15 2002 - 23:50:55 CST
> Hi Experts,
>
> I have two tables ( T1 and T2 ) having the same structure and data.
> Now T1 has some rows inserted into it and some of the column values in
> it are also updated.
> [Both T1 and T2 have an id (number) as the PK ]
>
> Is it possible for me to generate Insert / Update scripts, which will
> make the data in T2 the same as in T1.
>
>
> Thanks In advance,
> Sunil.
>
>
>