Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Q: Oracle sqlplus way to capture all duplications and removal.
ColoC meinte:
> Hi, is there someone to help me?
>
> I have got a data duplication case in a big Oracle 8 table. Many of
> the records were processed and loaded twice, meanwhile there are much
> more good records without duplication. The table has 60 fields for
> each record.
>
> Is there a simple Oracle sqlplus way to capture all these duplications
> and remove the duplications?
>
> Thanks.
>
> ColoC
Hi ColoC,
you can use self-join:
where a.uk_column1 = b.uk_column1 and a.uk_column2 = b.uk_column2 and ... and a.rowid != b.rowid;
begin
open cur_dup;
loop
fetch cur_dup into v_rowid; exit when cur_dup%notfound; delete from your_table where rowid = v_rowid;
end;
/
HTH
Albert
-- Trouble with Windows - Reboot! Trouble with Linux - Be root!Received on Mon Sep 08 2003 - 09:47:34 CDT