I'm pretty new to databases and programming. I'm not very good with the computer lingo so stick with me. I have a csv
file that I'm trying to load into my Oracle
database. It contains account information such as name, telephone number, service dates etc. I've installed Oracle 11g Release 2
. This is what I've done so far step by step..
1) Ran SQL Loader
I created a new table with the columns that I needed. For example
create table Billing ( TAP_ID char(10), ACCT_NUM char(10), MR_ID char(10), HOUSE_NUM char(10), STREET char(30), NAME char(50)
2) It prompted me that the Table was created. Next I created a control file for the data in notepad which was located in the same directory as my Billing table and has a .ctl extension. GIS.csv is the file im getting the data from and is also in the same directory and named it Billing.ctl, which looked like so..
load data
infile GIS.csv
into table Billing
fields terminated by ','
(TAP_ID, ACCT_NUM, MR_ID, HOUSE_NUM, STREET, NAME)
3) Run sqlldr from command line to use the control file
sqlldr myusername/mypassword Billing.ctl
This is where I am stuck. Ive seen video tutorials of exactly what I'm doing but I get this error:
SQL*Loader-522: lfiopn failed for file (Billing.log)
Any ideas on what I could be doing wrong here?
Update
I just moved the files into a separate directory and I suppose I got past the previous error. By the way yes Billing.ctl and GIS.csv are in the same directory.
But now I have another error:
'SQL*Loader-350: Syntax error at line 1.
Expecting keyword LOAD, found "SERV TAP ID". "SERV TAP ID","ACCT NUMBER","MTR ID","SERV HOUSE","SERV STREET","SERV ^'
I dont understand why its coming up with that error. My billing.ctl has a load.
LOAD data
infile GIS.csv
into table Billing
fields terminated by ','
(TAP_ID, ACCT_NUM, MTR_ID, SERV_HOUSE, SERV_STREET, SERV_TOWN, BIL_NAME, MTR_DATE_SET, BIL_PHONE, MTR_SIZE, BILL_CYCLE, MTR_RMT_ID)
Any thoughts?
Prepare the input files The load data into table emails insert instruct the SQL*Loader to load data into the emails table using the INSERT statement. The fields terminated by "," (email_id,email) specifies that each row in the file has two columns email_id and email separated by a comma (,).
Sqlldr wants to write a log file in the same directory where the control file is. But obviously it can't. It probably doesn't have the required permission.
If you're on Linux or Unix, try to run the following command the same way you run sqldr:
touch Billing.log
It will show whether you have the permissions.
Update
The proper command line is:
sqlldr myusername/mypassword control=Billing.ctl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With