Connecting Tech Pros Worldwide Help | Site Map

Sqlloder

Member
 
Join Date: Jul 2007
Posts: 78
#1: Nov 14 '07
Hi,

I loaded amount of data into one table.Table name is SAMPLE. Some of the data inserted correctly. Some data is inserted but not correctly.

My SQL Loder commands:

In command promt, I wrote like

Sqlldr userid=scott/tiger@flower control=sample.ctl log=sample.log

Sample Control file:

Expand|Select|Wrap|Line Numbers
  1. LOAD DATA
  2. INFILE *
  3. INTO TABLE SAMPLE
  4. FIELDS TERMINATED BY ","
  5. (
  6.   ID,
  7.   NAME,
  8.   STREET
  9. )
  10. BEGINDATA
  11. 10,'MICHAEL',JAMKHYA ROAD,89,CROSS STREET,
  12. 20,'SATHEEH',JKOIYTT STKAJ,12,MAIN ROAD',
  13.  

Data loaded like

ID NAME STREET

10 'MICHAEL' JAMKHYA ROAD
20 'SATHEEH' JKOIYTT STKAJ


But I need full values JAMKHYA ROAD,89,CROSS STREET in street columns.


What I found means, the oracle server accepts street columns values up to first comma.because I mention in control file fields terminated by “’ ”.so that only it writes like this.

How to avoid these errors?
amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#2: Nov 14 '07

re: Sqlloder


As a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use the tags in future.

MODERATOR.
amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#3: Nov 14 '07

re: Sqlloder


Quote:

Originally Posted by holdingbe

Hi,

I loaded amount of data into one table.Table name is SAMPLE. Some of the data inserted correctly. Some data is inserted but not correctly.

My SQL Loder commands:

In command promt, I wrote like

Sqlldr userid=scott/tiger@flower control=sample.ctl log=sample.log

Sample Control file:

Expand|Select|Wrap|Line Numbers
  1. LOAD DATA
  2. INFILE *
  3. INTO TABLE SAMPLE
  4. FIELDS TERMINATED BY ","
  5. (
  6.   ID,
  7.   NAME,
  8.   STREET
  9. )
  10. BEGINDATA
  11. 10,'MICHAEL',JAMKHYA ROAD,89,CROSS STREET,
  12. 20,'SATHEEH',JKOIYTT STKAJ,12,MAIN ROAD',
  13.  

Data loaded like

ID NAME STREET

10 'MICHAEL' JAMKHYA ROAD
20 'SATHEEH' JKOIYTT STKAJ


But I need full values JAMKHYA ROAD,89,CROSS STREET in street columns.


What I found means, the oracle server accepts street columns values up to first comma.because I mention in control file fields terminated by “’ ”.so that only it writes like this.

How to avoid these errors?

Enclose the data in double quotes as shown below:

Expand|Select|Wrap|Line Numbers
  1. LOAD DATA
  2. INFILE *
  3. INTO TABLE SAMPLE
  4. FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
  5. (
  6.   ID,
  7.   NAME,
  8.   STREET
  9. )
  10. BEGINDATA
  11. 10,"MICHAEL","JAMKHYA ROAD,89,CROSS STREET",
  12. 20,"SATHEEH","JKOIYTT STKAJ,12,MAIN ROAD",
  13.  
Member
 
Join Date: Jul 2007
Posts: 78
#4: Nov 14 '07

re: Sqlloder


Quote:

Originally Posted by amitpatel66

Enclose the data in double quotes as shown below:

Expand|Select|Wrap|Line Numbers
  1. LOAD DATA
  2. INFILE *
  3. INTO TABLE SAMPLE
  4. FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
  5. (
  6.   ID,
  7.   NAME,
  8.   STREET
  9. )
  10. BEGINDATA
  11. 10,"MICHAEL","JAMKHYA ROAD,89,CROSS STREET",
  12. 20,"SATHEEH","JKOIYTT STKAJ,12,MAIN ROAD",
  13.  


Hi,

I have 200 hundred record..It will take long time .. please tell to other way
amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#5: Nov 14 '07

re: Sqlloder


Quote:

Originally Posted by holdingbe

Hi,

I have 200 hundred record..It will take long time .. please tell to other way

SQL LOADER allows two methods:

1. Terminated BY Optionally Enclosed BY
2. POSITION (in case if the data is of fixed length, but it is not so in your case)

you need to go with method 1.

If you have a textpad, copy paste the data in it, create a macro to enclose the text with double quotes and use it.

You can also do that with a excel sheet as well
Reply