Internet Development

Moderators: None (Apply to moderate this forum)
Number of threads: 1020
Number of posts: 1885

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
"how to find duplicate records in oracle data base" Posted by vijaya_8147 on 13 Jul 2005 at 2:55 AM
I would like to know the oracle (SQL) query to find the duplicate records in a oracle data base.
Kindly help me.
Thanks in advance,
Bye
Report
Re: "how to find duplicate records in oracle data base" Posted by Gothmordrin on 5 Jan 2006 at 12:40 PM
: I would like to know the oracle (SQL) query to find the duplicate records in a oracle data base.
: Kindly help me.
: Thanks in advance,
: Bye
:

By duplicate records I presume you mean records with similar keys?
(Which begs the question as to why your primary key constraint didn't kick out the duplicate entries!)

Try this:-

select *
from table
group by key1, key2, ..., keyN
having count (*) > 1;

If you want to list them for a data cleanup excercise add an order by clause to list them in the order you want.

Gothmordrin
Think it through first - then pester someone.

Report
Re: "how to find duplicate records in oracle data base" Posted by sabeerpasha on 21 Feb 2009 at 11:58 PM
U can find and delete the Duplicate files

delete from test a
where rowid <> ( select max(rowid)
from test b
where a.sno = b.sno
and a.sname = b.sname )

This querry will find duplicate rows and delete those.

Regards,
Pasha
Report
Re: "how to find duplicate records in oracle data base" Posted by benf101 on 29 May 2009 at 8:42 AM
This way worked for me:

SELECT COL_TO_CHECK, COUNT(COL_TO_CHECK)
FROM TABLE_NAME
GROUP BY COL_TO_CHECK
HAVING COUNT(COL_TO_CHECK) > 1


Report
This post has been deleted. Posted by beerandmilk on 14 Feb 2011 at 9:51 AM
This post has been deleted.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.