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: SQLLDR Question

Re: SQLLDR Question

From: Galen Boyer <galenboyer_at_hotpop.com>
Date: 6 Mar 2002 22:29:06 -0600
Message-ID: <u8z944yvr.fsf@rcn.com>


On 6 Mar 2002, rkg100_at_erols.com wrote:
> So one way to do this would be to load the data into a temp table and
> as part of the patch only insert the records that are not duplicates
> to the load table.

You could delete the duplicate rows after each load:

	delete from load_table t1
	where rowid <> (
		    select min(rowid)
		    from   load_table t2
		    where  correlate t1 and t2 on what
                           makes the rows unique
                           in the load table.)

For example:

SQL> create table t (fld1 number, fld2 number, fld3 number);

Table created.

SQL> insert into t values (1,1,1);
1 row created.

SQL> insert into t values (2,2,2);
1 row created.

SQL> insert into t values (1,1,1);
1 row created.

SQL> insert into t values (2,2,2);
1 row created.

SQL> insert into t values (3,3,3);
1 row created.

SQL> select * from t;

      FLD1 FLD2 FLD3
---------- ---------- ----------

	 1	    1	       1
	 2	    2	       2
	 1	    1	       1
	 2	    2	       2
	 3	    3	       3

SQL> 	delete from t t1
	where rowid <> (
		    select min(rowid)
		    from   t t2
		    where  t1.fld1 = t2.fld1
     		    and	   t1.fld2 = t2.fld2
     		    and	   t1.fld3 = t2.fld3);

2 rows deleted.

SQL> select * from t;

      FLD1 FLD2 FLD3
---------- ---------- ----------

	 1	    1	       1
	 2	    2	       2
	 3	    3	       3


-- 
Galen deForest Boyer
Sweet dreams and flying machines in pieces on the ground.
Received on Wed Mar 06 2002 - 22:29:06 CST

Original text of this message

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