Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Generate update / Insert scripts
Thanks HJR !
I am sorry I did not mention the oracle version. I cannot use the 'merge' sql command as the two tables may be in different databases (under different versions) . I have a local copy of T1 and T2 in the same database. What I have to do is generate scripts and send it to people who will then run scripts, to update their T2 table.
I guess a pl/sql prg which goes row by row (and col by col) is the only way which I can generate the script.
Thanks,
Sunil.
"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
> ===============================
>
>
> "Sunil" <sunil_franklin_at_hotmail.com> wrote in message
> news:ftAk8.7$ht6.87_at_inet-nntp1.oracle.com...
> > 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.
> >
> >
> >
>
>
Received on Sun Mar 17 2002 - 23:12:04 CST