Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: multiple infiles into a same table/record
> 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;
-- TomekBReceived on Fri May 28 2004 - 02:00:05 CDT