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

Home -> Community -> Usenet -> comp.databases.oracle -> Re: Large Table Update/Merge problem

Re: Large Table Update/Merge problem

From: Pratap <pratap_fin_at_rediffmail.com>
Date: 18 Aug 2004 21:52:38 -0700
Message-ID: <830861d2.0408182052.49a48bad@posting.google.com>


Do the update first.

update
(

select a.col1 acol1, b.col1 bcol1
from a, b
where a.key = b.key
)
set acol1 = bcol1

make sure you have unique key on the "key" columns of both tables.

Then go for the insert -

insert into b select * from a where not exists
(

select null from b where a.key = b.key
)

You may need to set statistics on the temporary tables to get an efficient plan.
(Cannot gather statistics on temporary tables)

Pratap Deshmukh
Cognizant Technology Solutions, India Received on Wed Aug 18 2004 - 23:52:38 CDT

Original text of this message

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