Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 3.00 average. Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 16th, 2012, 01:01 PM
nutjob nutjob is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 10 nutjob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 36 m 42 sec
Reputation Power: 0
SQL Loader: Load single column

Hi,

I am trying to load a single column into a Table. Below is the ctl file:

OPTIONS (ERRORS=10000)
LOAD DATA
TRUNCATE
INTO TABLE "ECOMM"."CC_ECOMM"
TRAILING NULLCOLS
(EMAIL_ID)

Calling loader:
sqlldr silent=ALL userid=username/password@DB control=/home/DEV/control/CC_ECOMM.CTL log=/home/DEV/log/Unsubs.log bad=/home/DEV/log/Unsubs.bad discard=/home/DEV/log/Unsubs.dis data=/home/DEV/files/CC_ECOMM.TXT

Though the count in the Table after load is the same as the input file, they are all NULL.

I tried adding FIELDS TERMINATED BY X'A' for new line and also FIELDS TERMINATED BY X'D' for carriage return. Both times bad file was created and the records that were loaded were again NULL.

The input file has a list of emails:
iatraveler2008@aol.com
iaz65@aol.com
2blue2brown@comcast.net
2c3mwilson@embarqmail.com
abigailolschan@comcast.net
imisskoco@aol.com

I tried FIELDS TERMINATED BY X'10' and FIELDS TERMINATED BY X'13' too for new line and carriage return respectively. This time there were no bad file created, but the Table has Null values.
******************************************
Log File contents:

Number to load: ALL
Number to skip: 0
Errors allowed: 10000
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Silent options: FEEDBACK, ERRORS and DISCARDS

Table "ECOMM"."CC_ECOMM", loaded from every logical record.
Insert option in effect for this table: TRUNCATE
TRAILING NULLCOLS option in effect

Column Name Position Len Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
EMAIL_ID FIRST * O(X13) CHARACTER


Table ""ECOMM"."CC_ECOMM"":
914361 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.


Space allocated for bind array: 16512 bytes(64 rows)
Read buffer bytes: 1048576

Total logical records skipped: 0
Total logical records read: 914361
Total logical records rejected: 0
Total logical records discarded: 0
******************************************

Please help!

Reply With Quote
  #2  
Old November 16th, 2012, 06:05 PM
spacebar208's Avatar
spacebar208 spacebar208 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Location: spaceBAR Central
Posts: 188 spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 9 h 4 m 54 sec
Reputation Power: 41
If the input file is from windows(i.e. each record ends with a carriage return and line feed) then the below example should work for you:
Code:
--Control file:
Load
 infile       "/home/DEV/files/CC_ECOMM.TXT" "str '\r\n'"
 badfile      "/home/DEV/log/Unsubs.bad"
 discardfile  "/home/DEV/log/Unsubs.dis"
 replace
 into table ecomm.cc_ecomm
 ( email_id )


sqlldr silent=ALL userid=username/password@DB control=/home/DEV/control/CC_ECOMM.CTL log=/home/DEV/log/Unsubs.log

Reply With Quote
  #3  
Old November 19th, 2012, 11:16 AM
nutjob nutjob is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 10 nutjob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 36 m 42 sec
Reputation Power: 0
I am getting the following error when i specify "str '\r\n'" with the infile path:

SQL*Loader-510: Physical record in data file (/home/DEV/files/CC_ECOMM.TXT) is longer than the maximum(1048576)
SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.

Data File: /home/DEV/files/CC_ECOMM.TXT
File processing option string: "str '^M
'"

Reply With Quote
  #4  
Old November 20th, 2012, 03:03 PM
spacebar208's Avatar
spacebar208 spacebar208 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Location: spaceBAR Central
Posts: 188 spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 9 h 4 m 54 sec
Reputation Power: 41
Does your input file(CC_ECOMM.TXT) have a carriage return and line feed(i.e. \r\n) at the end of each record?
See example from the example data you supplied below:


Code:
> cat CC_ECOMM.TXT
iatraveler2008@aol.com
iaz65@aol.com
2blue2brown@comcast.net
2c3mwilson@embarqmail.com
abigailolschan@comcast.net
imisskoco@aol.com


> od -c CC_ECOMM.TXT
0000000   i   a   t   r   a   v   e   l   e   r   2   0   0   8   @   a
0000020   o   l   .   c   o   m  \r  \n   i   a   z   6   5   @   a   o
0000040   l   .   c   o   m  \r  \n   2   b   l   u   e   2   b   r   o
0000060   w   n   @   c   o   m   c   a   s   t   .   n   e   t  \r  \n
0000100   2   c   3   m   w   i   l   s   o   n   @   e   m   b   a   r
0000120   q   m   a   i   l   .   c   o   m  \r  \n   a   b   i   g   a
0000140   i   l   o   l   s   c   h   a   n   @   c   o   m   c   a   s
0000160   t   .   n   e   t  \r  \n   i   m   i   s   s   k   o   c   o
0000200   @   a   o   l   .   c   o   m  \r  \n
0000212

Reply With Quote
  #5  
Old November 21st, 2012, 10:16 PM
kartikay kartikay is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 1 kartikay User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 52 sec
Reputation Power: 0
Please try this

*** assuming your data file name is emails.txt

load data
infile emails.txt
truncate
into table emails
fields terminated by ' '
trailing nullcols
(email_id)


will work for sure

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > SQL Loader: Load single column

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap