Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Can you load a comma delimitted text file into a table. but only take specified columns??
One way would be to identify the fields you don't want to load, as FILLER
fields.
Please refer to the documentation for details (Utilities:
http://technet.oracle.com)
Example:
Table x:
create table x (a number(10), b varchar2(10), c varchar2(10));
Control File:
LOAD DATA
INFILE 'x.dat'
BADFILE 'x.bad'
TRUNCATE
INTO TABLE x
FIELDS TERMINATED BY ','
(col1 FILLER CHAR,
col2 FILLER CHAR,
a CHAR,
col4 FILLER CHAR,
b CHAR,
col6 FILLER CHAR,
c CHAR
)
Usage: sqlldr userid=username/password control=x.ctl
Data File:
dummy,dummy,1,dummy,2,dummy,3,dummy dummy,dummy,10,dummy,20,dummy,30,dummy dummy,dummy,100,dummy,200,dummy,300,dummy
Final result:
select * from x;
A B C
---------- ---------- ----------
1 2 3 10 20 30 100 200 300
Anurag
"Anus" <anus_at_anus.anus> wrote in message
news:rh5kiukk33g1ufpeg5e1vir72icrnurkbt_at_4ax.com...
> I have a really big comma delimted text file, with lots of fields
>
> ( example - 30 Fields)
>
> but all i want to do is take field8, field15, and and field16
>
>
> I know i could parse the file with awk or perl to have a uniform text
> file,
>
> but i was wondering if SQL*Loader has a way to specify certain columns
> to be obtained from the text file???
>
> ( remember - it is comma delimited NOT a Position text file )
>
>
Received on Tue Jul 09 2002 - 00:11:04 CDT
![]() |
![]() |