Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Duplicate rows
Delete duplicate records
Sanjay Raj
06 Dec 2001, Rating 4.42 (out of 5)
Here is a short Oracle script that deletes duplicate records from a table based on the unique columns selected:
Rem del_dup.sql
Rem
Rem Script to delete duplicate rows from a table
Rem
Rem Enter Table_Name as MY_TABLE
Rem And Column_List as COLUMN_1,COLUMN_2,COLUMN_3 ... Column_N
Rem (i.e. no spaces)
DELETE FROM &table_name WHERE ROWID IN (SELECT MIN (ROWID) FROM &table_name GROUP BY &column_list HAVING COUNT (*) > 1); EXIT WHEN SQL%NOTFOUND;
-----Original Message-----
From: Alexander Ordonez [mailto:aordonez_at_ccss.sa.cr]
Sent: Wednesday, February 06, 2002 10:33 AM
To: Multiple recipients of list ORACLE-L
Subject: Duplicate rows
Hi gurus,
I need detect and delete duplicate rows in any table, somebody helpme
thanks!!!
@lex
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Alexander OrdonezReceived on Wed Feb 06 2002 - 12:57:28 CST
INET: aordonez_at_ccss.sa.cr
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
![]() |
![]() |