Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL: best way to find and remove duplicate rows ( keep 1 row )
Declare
Cursor C1 is
select distinct key,rowid
from mytable;
Begin
for i in C1 loop
delete mytable where key = i.key and rowid != i.rowid;
Paul Chu wrote:
> Hi all,
>
> I would like a script which would find all the duplicate rows in the table
> and keep 1 of the duplicate rows and delete the others.
>
> Any suggestions.
>
> Regards, Paul
Received on Mon Aug 09 1999 - 06:46:20 CDT