Re: sql loader question - inserting into multiple tables
Date: Wed, 10 Jul 2002 22:32:54 -0400
Message-ID: <uiprisrbvcdka2_at_corp.supernews.com>
What OS?
Is your file fixed format or delimted (Though it appears from example thats
its fixed format)?
I don't remember the sql*ldr syntax for Oracle 7
... but a way you would do it in sql*ldr in Oracle 8i (and it might be valid
for 7 also ...)
LOAD DATA
INFILE 'myfile.dat'
<TRUNCATE/REPLACE/APPEND>
INTO TABLE tab1
WHEN flag = 'X'
(flag FILLER POSITION(01:01) CHAR,
col1 POSITION(02:05) CHAR)
INTO TABLE tab2
WHEN flag = 'Y'
(flag FILLER POSITION(01:01) CHAR,
col1 POSITION(02:05) CHAR)
... or if you are in UNIX ... you can use grep/egrep + sed .. or perl/python/ ..... to filter it out ..
cat mydata.dat | egrep '^X' | sed 's/^.//g' > tab1.dat cat mydata.dat | egrep '^Y' | sed 's/^.//g' > tab2.dat
and load tab1.dat and tab1.dat using simple sql*loader technique ...
_there_can_be_so_many_ways_to_do_this_
Anurag
"Tom Reid" <thomas_p_reid_at_hotmail.com> wrote in message
news:6dfc26f.0207100005.5570fa38_at_posting.google.com...
> Hi, I want to load data from a file into two tables depending on the
> values of the first field in the file but I don't want to actually load
> the first field.
>
> eg file contains:-
> X1234
> YABCD
> X5678
> YWXYZ
>
> -> after the load table1 should have two records, 1234 and 5678
> and table2 should have two records, ABCD and WXYZ
>
> Is it possible to do this, I'm running V7.4.3
Received on Thu Jul 11 2002 - 04:32:54 CEST