Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

ignore_row_on_dupkey_index tips

Oracle Database Tips by Donald BurlesonJanuary 1, 2015

Oracle 11g now has a feature to silently allow insert SQL to accept duplicates with the ignore_row_on_dupkey_index hint.  When ignore_row_on_dupkey_index hint is used in a SQL insert on a table with a unique key index, all duplicates will be silently ignored, rather than causing the traditional error, ORA-00001 unique constraint violated.

The Oracle docs note that the ignore_row_on_dupkey_index are unlike any other hints because they have an effect on the semantics of the SQL statement, actually changing the functionality of the DML statament:

The change_dupkey_error_index, ignore_row_on_dupkey_index, and retry_on_row_change hints are unlike other hints in that they have a semantic effect.

The general philosophy explained in "Hints" does not apply for these three hints.

The ignore_row_on_dupkey_index hint is also unique because unlike a regular hint (hints are embedded inside comments), you will get an error.  In traditional SQL hints, hints with syntax, semantic or resource errors will cause the hint to be ignored. 

However, this hint will cause an ORA-38912 error if you don't pass the correct arguments.  Note that the ignore_row_on_dupkey_index hint requires two arguments, the table name and index name.  If the index name is omitted, the ORA-38912 error is thrown:

insert /*+ ignore_row_on_dupkey_index(unique_cust) */
into
   unique_cust
(select * from non_unique_cust);

 

ORA-38912:  An index must be specified in the index hint

Cause:  Index specification was missing in an ignore_row_on_dupkey_index or change_dupkey_error_index hint.

Action:  In the hint, specify a unique index that exists on the table.

Functionally, the ignore_row_on_dupkey_index hint is somewhat similar to the SQL merge statement because it ignores duplicates on insert. 

Examples of using the ignore_row_on_dupkey_index hint

Here is an example of using this hint to load a unique table from a non-unique table, while preventing aborts due to duplicate values:

insert /*+ ignore_row_on_dupkey_index(unique_cust, unique_cust_pk_idx) */
into
   unique_cust
(select * from non_unique_cust);


 
Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.



 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational