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: multiple infiles into a same table/record

Re: multiple infiles into a same table/record

From: Noel <tomekb_at_softman.pl>
Date: Fri, 28 May 2004 09:00:05 +0200
Message-ID: <c96o0g$iom$1@inews.gazeta.pl>


> i have a requirement that i have to load data from multiple
> datafiles into a table and the records are matched between the
> datafiles using a column.(say something like if the first 5 characters
> of a physical record in datafile1 matches with first 5 characters of
> datafiles2, it means both should be joined and put into the same
> record. has anyone done this? any insight into how to do this?
> thanks,
>

Hello.
You could load it into two tables.

TABLE_ONE -- from first datafile
 (
 FIVE_CHAR_MATCH VARCHAR2(5),
 DATA1 DATATYPE,
.
.
DATA_M DATAYPE
);

TABLE_TWO -- from second datafile
 (
 FIVE_CHAR_MATCH VARCHAR2(5),
 DATA1 DATATYPE,
.
.
DATA_N DATAYPE
);

(You need to create indexes on five_char_match columns in both tables)

And finally:

INSERT INTO DEST_TABLE(COL1,....,COLNM)
 SELECT O.FIVE_CHAR_MATCH, O.DATA1,...O,DATAN, T.DATA1,...,T.DATAN    FROM TABLE_ONE O, TABLE_TWO T
   WHERE O.FIVE_CHAR_MATCH=T.FIVE_CHAR_MATCH;

--
TomekB
Received on Fri May 28 2004 - 02:00:05 CDT

Original text of this message

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