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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Update one table's data from another table (but skip identical records)

Re: Update one table's data from another table (but skip identical records)

From: DA Morgan <damorgan_at_psoug.org>
Date: Mon, 12 Feb 2007 15:54:45 -0800
Message-ID: <1171324484.444257@bubbleator.drizzle.com>


gordon_at_panix.com wrote:
> I'm looking for a way to update data in one table with data from
> another table.
>
> More specifically, if there are any records in the two tables which
> have matching primary keys but differing data in at least one other
> column, I need to update the values in the old table from the new
> table.
>
> I can't just do a blanket update of every record, because that would
> result in a lot of unneccesary updates -- I only want to update
> records which actually have different data.
>
> I tried an UPDATE FROM statement, but Oracle doesn't support that.
>
> I tried a MERGE INTO statement, but Oracle 9i requires action to be
> taken both when the records match *and* when they don't. Bah!
>
> Any suggestions?

And a correlated update won't work? Why? http://www.psoug.org
click on Morgan's Library
click on UPDATE

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Mon Feb 12 2007 - 17:54:45 CST

Original text of this message

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