Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Delete Duplicate Records !!!!
HI Maybe this will help...
In your case feed in the whole column list...
Rem
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)
Accept table_name Prompt 'Enter Table Name: ' Accept column_list Prompt 'Enter Column List (no spaces): '
BEGIN LOOP DELETE FROM &table_name
WHERE ROWID IN (SELECT MIN (ROWID) FROM &table_name GROUP BY &column_list HAVING COUNT (*) > 1);
EXIT WHEN SQL%NOTFOUND; END LOOP; COMMIT; END; /
In article <7u5s2o$116a$1_at_newssvr04-int.news.prodigy.com>,
"Steve" <schen_at_prodigy.net> wrote:
> Hi, All:
>
> Can anybody tell me how to find all duplicate records and delete them
in one
> coding? We have thousand of duplicate records needed to be deleted
in
> one table (please don't ask why -- unquiue key issue).
>
> Apprecreciated.
>
> Steve
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Oct 15 1999 - 05:15:46 CDT