Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL*Loader

Posted on 2003-11-04
5
Medium Priority
?
568 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 8

Accepted Solution

by:
Danielzt earned 252 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 248 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

688 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