Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL: best way to find and remove duplicate rows ( keep 1 row )

Re: PL/SQL: best way to find and remove duplicate rows ( keep 1 row )

From: Kenneth C Stahl <BluesSax_at_Unforgettable.com>
Date: Mon, 09 Aug 1999 07:46:20 -0400
Message-ID: <37AEBF8B.83631BDA@Unforgettable.com>


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;

    End loop
End;

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US