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

Home -> Community -> Usenet -> c.d.o.server -> Re: Delete Duplicate Records !!!!

Re: Delete Duplicate Records !!!!

From: <tjmxyz_at_my-deja.com>
Date: Fri, 15 Oct 1999 10:15:46 GMT
Message-ID: <7u6usb$8sj$1@nnrp1.deja.com>


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)

Rem
Rem

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

Original text of this message

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