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: Frank van Bortel <f.van.bortel_at_vnl.nl>
Date: Fri, 15 Oct 1999 12:43:42 -0700
Message-ID: <380783EE.AFB36BA3@vnl.nl>


Steve 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

Via rowid. Approach can differ based on what records you want to preserve, but the idea is

delete from your_table where rowid in (   select rowid
  from your_table x
  where x.rowid > (
    select min(y.rowid)
    from your_table y
    where y.uk_column1 = x.uk_column1
    and y.uk_column2 = x.uk_column2
    and ...)
  )

--
Met vriendelijke groet/kind regards,

Frank van Bortel
Technical consultant Oracle

Work:                                Home:
----------------------------------   ----------------------------
V&L Informatica BV                   Hunzestraat 4
Palatijn 3, 7521 PN Enschede         7555 WB Hengelo
PoBox 545, 7500 AM Enschede          (31)074-2425046
053-4341500 Received on Fri Oct 15 1999 - 14:43:42 CDT

Original text of this message

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