Solved

SQL*Loader

Posted on 2003-11-04
5
550 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

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…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

920 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

16 Experts available now in Live!

Get 1:1 Help Now