Solved

SQL*Loader

Posted on 2003-11-04
5
548 Views
Last Modified: 2013-12-12
I have certain constraints on the DB. When I load a file using SQL*Loader, however, the constraints are violated. Why does this happen? Is there any way to ignore the violating records, and complete loading?
0
Comment
Question by:archan_dhar
5 Comments
 
LVL 8

Accepted Solution

by:
Danielzt earned 63 total points
Comment Utility
try to do this way base on your requirements.

1: if you care about data more than constraints, you can diable the constraints and then load.

2: you can use these two options to control  the number of error or discards.

discardmax              Number of discards to allow
errors          Number of errors to allow

3: change your data to meet your constraints.

0
 

Author Comment

by:archan_dhar
Comment Utility
Thanks for your comments. I have already successfully tried out case 3, but ideally, I wont like that method.

Regarding case 2, I just want to discard the cases that violates the unique key constraint on one column. No specific number of discards can be pin pointed.

To be very clear with my requirement, let me give an example. Following is the data file:

AA,PPPPP,1
BB,QQQQ,2
BB,FFFFF,3
CC,GGGG,4
CC,KKKK,5
DD,LLLL,6

The column in the table that is assigned for the first column in the data file is the primary key.
My problem is when I upload the above file into DB using SQL*Loader, all the columns get loaded. This violates the unique key constraint on the primary key. I just want the following rows to be loaded:

AA,PPPPP,1
BB,QQQQ,2
CC,GGGG,4
DD,LLLL,6
0
 
LVL 3

Assisted Solution

by:ubasche
ubasche earned 62 total points
Comment Utility

You must set the number of discards to allow to a high enough number.
It will work, if you set it higher than the number of duplicates you will get it the file you are loading.

E.g. If you have 400 duplicates and you set the number of discards to 1000,
you will get 400 discards and the load will complete (because you still have 600 discards left before SQL*Loader aborts the load).

0
 
LVL 22

Expert Comment

by:Helena Marková
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between Danielzt and ubashe.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Henka
EE Cleanup Volunteer
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Via a live example, show how to take different types of Oracle backups using RMAN.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now