This is just an effort to share a solution that we used in our organisation for the benefit of all.
Aim: We have a file MYFILE.CSV
. We need to create a table in Oracle database and load this file into that table.
This is just an effort to share a solution that we used in our organisation for the benefit of all.
Aim: We have a file MYFILE.CSV
. We need to create a table in Oracle database and load this file into that table.
create table BLOBTABLE(FILENAME blob);
Create a text file, MYDATA.TXT
with the text MYFILE.CSV
.
Control File: MYDATA.CTL
load data
infile MYDATA.TXT
truncate into BLOBTABLE
fields terminated by ‘,’ trailing nullcols
(
input_file filler,
FILENAME lobfile(input_file)
terminated by eof
)
Place all the three files, MYFILE.CSV
, MYDATA.CTL
and MYDATA.TXT
in a folder. In command prompt, change directory to that folder and type the below command.
sqlldr userid=user/pwd@sid control=mydata.ctl log=mydata.log bad=mydata.bad
Hit ENTER!!!