consider a fixed length file
12345abcd8901
12345abcd7777
12345njdu8888
12345hdku8388
i would like to dump it in to oracle DB using sql loader
12345 in to first coloumn
abcd in to second coloumn
8901 in to 3rd coloumn
consider a fixed length file
12345abcd8901
12345abcd7777
12345njdu8888
12345hdku8388
i would like to dump it in to oracle DB using sql loader
12345 in to first coloumn
abcd in to second coloumn
8901 in to 3rd coloumn
Two steps
1.Make a csv file
awk 'BEGIN{FIELDWIDTHS = "5 4 4"}; {print $1","$2","$3;}' filename
load data
infile 'filename.csv'
into table tablename
fields terminated by ","
You can edit the control file of the sqlloader by the following:
LOAD DATA
INFILE <data_file_path_and_name>
INTO TABLE <table_name> (
<column_name> POSITION(<integer>:<integer>) <data_type>,
<column_name> POSITION(<integer>:<integer>) <data_type>,
<column_name> POSITION(<integer>:<integer>) <data_type>)
I.e:
LOAD DATA
INFILE /tmp/load_data.dat
INTO TABLE t1
(col1 POSITION(1:5) ,
col2 POSITION(6:9) ,
col3 POSITION(10:13))
Regards,
Nir