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: "Seek and destroy" duplicate entries

Re: "Seek and destroy" duplicate entries

From: Brian Peasland <dba_at_nospam.peasland.net>
Date: Mon, 16 Oct 2006 14:27:47 GMT
Message-ID: <J78G6G.Hv1@igsrsparc2.er.usgs.gov>


Alex wrote:
> Hello NG,
>
> considering the following table-structure (import-table):
>
> Material_Nr || Alternative_Hierarchy
> -------------||--------------------
> A || 10xalpha
> A || 10xalpha
> A || 10xalpha
> A || 10xalpha
> B || 20xgamma
> B || 20xgamma
> B || 20xgamma
> B || 20xgamma
> ...
>
> The data I've to import isn't normalized. Therefore, the original
> datasets are inflated to nearly 140.000.
> While I'm able to delete about 130.000 datasets by killing those, who
> have NULL as "Alternative_Hierarchy", I've still got >8.000 datasets
> left.
>
> But a lot of these are still duplicates!
> Having only the mentioned columns, I failed to apply the method of
> S-A-D using the MIN()/MAX() functions.
>
> Can anyone provide me with a solution of killing the duplicates (except
> one) ?
> Any help will be appreciated!
>
>
> Alex Sauer
>

Depending on how many rows, you may find that the MIN(ROWID) option previously discussed is slow. Since you have no FK constraints on this table, you might want to try this approach:

CREATE TABLE import_table_temp
AS SELECT DISTINCT material_nr, alternative_hierarchy

    FROM import_table;

TRUNCATE import_table;

INSERT INTO import_table SELECT material_nr, alternative_hierarchy

    FROM import_table_temp;

DROP TABLE import_table_temp;

This is just an alternative solution. And there is no guarantee that this is faster.

HTH,
Brian

-- 
===================================================================

Brian Peasland
dba_at_nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown
Received on Mon Oct 16 2006 - 09:27:47 CDT

Original text of this message

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