Solved

SQL*Loader

Posted on 2003-11-04
5
557 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
ID: 9679362
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
ID: 9679596
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
ID: 9702227

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á
ID: 10200320
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Via a live example, show how to take different types of Oracle backups using RMAN.

830 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