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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting duplicates

Status
Not open for further replies.

hameja

Programmer
Oct 15, 2003
42
0
0
BE
how can I select duplicate records in a table that is not indexed
 
In sqlplus execute the ?/rdbms/admin/utlexcpt.sql script


Create an Index on the columns that make the KEY:

CREATE UNIQUE INDEX ON MyTABLE(COL1, COL2...)
EXCEPTIONS IN EXCEPTIONS;

All duplicate rows will be recorded in the EXCEPTIONS table.

[3eyes]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
In general it does not matter whether your table is indexed or not :)

Code:
select field1, ..., fieldN
from table
group by field1, ..., fieldN
having count(*)>1

You may also find dozen of similar threads with the same question and much wider set of advises, just use search.

Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top