RE: Merge command

From: Vishal Gupta <vishal_at_vishalgupta.co.uk>
Date: Sat, 12 Jan 2008 00:14:50 -0000
Message-ID: <787DD2F284E39D4FA3C2ABD2DAF1AB2DA046@mail.vishalgupta.co.uk>


Also keep in mind that if there are any null columns in a unique index based on which you are merging, then MERGE will fail on unique constraint voilation. You can avoid this by using NVL(col1,0) on nullable columns. I am working on a central repository of statspack to consolidate statspack data from various databases into central statspack repository database. I faced this problem on STAT$SGASTAT for nullable pool column.  

MERGE table1
using table2
on (col1=col1 and NVL(col2,0) = nvl(col2.0) ).....  

Regards,
Vishal Gupta


From: oracle-l-bounce_at_freelists.org on behalf of genegurevich_at_discover.com Sent: Thu 10/01/2008 20:39
To: 'oracle-l'
Subject: Re: Merge command

Thank you , Louis, Jonathan, Greg and sol beach . Really appreciate your responses.

I don't think I will be able to use the external tables due to the fact that the input files are located on a
remote server. Regarding the Merge command itself, are there any specific tuning actions I need to
do? Usually for an insert I try to drop the indices , do the insert, rebuild the indices. For an update,
I do keep the indices. Merge is a combination of the two, so I am leaning towards keeping the indices
on , is that reasonable?

thank you

Gene Gurevich

                                                                          
             "Jonathan Lewis"                                             
             <jonathan_at_jlcomp.                                            
             demon.co.uk>                                               To
             Sent by:                  "'oracle-l'"                       
             oracle-l-bounce_at_f         <oracle-l_at_freelists.org>           
             reelists.org                                               cc
                                                                          
                                                                   Subject
             01/10/2008 01:13          Re: Merge command                  
             AM                                                           
                                                                          
                                                                          
             Please respond to                                            
             jonathan_at_jlcomp.d                                            
                emon.co.uk                                                
                                                                          
                                                                          





If you have any uniqueness constraints on the table then you need to be sure that the merge command will not try to break those constraints, or the whole merge will fail and rollback.

The obvious example is where you might have two rows with the same primary key in the flat file that needs to be inserted - but if you have other unique keys declared the problem becomes a little more awkward.

Regards

Jonathan Lewis
http://jonathanlewis.wordpress.com

Author: Cost Based Oracle: Fundamentals
http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html

The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html

  • Original Message ----- From: <genegurevich_at_discover.com> To: "'oracle-l'" <oracle-l_at_freelists.org> Sent: Wednesday, January 09, 2008 11:01 PM Subject: Merge command

> Hi all:
>
> I am running v 10.2.0.3 and looking to using the MERGE command to load
data
> from a flat file. Some of the rows
> in the flat file are new and needs to be inserted into a fact table,
other
> - need to replace existing ones.
> I am planinng to have the application team load their file into a staging
> table via SQL*Loader and then load
> the data into the fact table via MERGE command. I have not used this
> command before; are there any issues
> that I should be aware of in terms of performance or bugs?
>
> thank you
>
> Gene Gurevich
>
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.17.13/1214 - Release Date:
08/01/2008
> 13:38
>
>

--
http://www.freelists.org/webpage/oracle-l






--
http://www.freelists.org/webpage/oracle-l





--
http://www.freelists.org/webpage/oracle-l
Received on Fri Jan 11 2008 - 18:14:50 CST

Original text of this message