If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Allow space in data

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-25-05, 03:09
amolbchougule amolbchougule is offline
Registered User
 
Join Date: Jun 2004
Posts: 9
Allow space in data

Hey there,

i suppose i have a very simple common but a problem in sqlldr.

I want to allow blank space in one of my columns.

say if i want to load the following
'amol '
' amol '
' amol '
' amol '

it gets loaded but i want toi retain the trailing blank characters. what i find in table is the trailing space is truncated and i get data length as
4
5
6
7

e.g 7 includes three prefixed blank characters and the 4 alphabets.

i want to see a regular length of 10 in each row.

any pointers?? any option in the control file of sqlldr??


Thanks,
Amol C
Reply With Quote
  #2 (permalink)  
Old 02-25-05, 03:12
amolbchougule amolbchougule is offline
Registered User
 
Join Date: Jun 2004
Posts: 9
uuufff

now what on earth is a 'blank space' ??? poor term, ain't it?

hey just dropped in to convey that the length of the data is 10.

'amol '

4 characters + 6 "blank spaces"
Reply With Quote
  #3 (permalink)  
Old 02-25-05, 06:37
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
Slightly modify the control file ... add the column length where needed.

Let's say, for example, that your control file looks like this:
Code:
LOAD DATA
INFILE some_file.txt
INTO TABLE your_table
(column_name POSITION(001:010) CHAR)
When loading, you'll lose trailing blanks. To prevent this to happen, the last row in example control file should look like this:
Code:
(column_name POSITION(001:010) CHAR(10))
P.S. I guess it is about Oracle SQL*Loader utility ... if so, I'd suggest you to post questions regarding Oracle in the Oracle forum.

Last edited by Littlefoot; 02-25-05 at 06:39.
Reply With Quote
  #4 (permalink)  
Old 02-25-05, 13:08
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,455
Wink

User the PRESERVE BLANKS option:
Code:
LOAD DATA
INFILE some_file.txt
INTO TABLE your_table
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' 
PRESERVE BLANKS
(COL1, COL2, ...etc...
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On