I know I have seen this posted before.......

 

We have a large range partitioned table that has duplicates in it.  What is the fastest way to remove the dups.?  I have the following scripts which do it but may be fast or slow.  What do you guys use?

DELETE FROM tablename
WHERE ROWID NOT IN
  (SELECT MIN(ROWID)
    FROM tablename
    GROUP BY fieldnames);

Or

alter table &table_name
       add constraint duplicate_cons
       unique key (&column_name)
         exceptions into exception table;

How to find duplicates:

select &column_name, count(&column_name)
         from &table_name
         group by &column_name
       having count(&column_name) > 1;

 

Tom

 

Reply via email to