Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Avoid Duplicate Records.

Status
Not open for further replies.

amerbaig

IS-IT--Management
Sep 4, 2001
58
CA
1. I have text file of atleast 4 million records.
2. I want to export it into a Table (Tab1) using SQL Loader. I may chose other option.
3. During export the duplicate records should not be populated into Tab1.
4. Duplicate Records should be populated in Tab2 for re-checking.

How to achive this.

Regards,

Amer
 
If you have a primary key on Tab1, duplicates should be rejected and the rejected records will go to a bad file. You can then load the bad file into Tab2.

If you don't have a primary key on Tab1, then I think it will be difficult to do this just from sql*loader. You will have to look at loading everything into Tab1 then moving the duplicates into Tab2.
 
First export all records,
then delete duplicate records.

there are several options for this
such as

Method 1:

SQL> DELETE FROM table_name A WHERE ROWID > (
2 SELECT min(rowid) FROM table_name B
3 WHERE A.key_values = B.key_values);

Method 2:
SQL> create table table_name2 as select distinct * from table_name1;
SQL> drop table_name1;
SQL> rename table_name2 to table_name1;

May be this, help you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top