dbTalk Databases Forums  

Escape character while loading data using sqlloader

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Escape character while loading data using sqlloader in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
rita
 
Posts: n/a

Default Escape character while loading data using sqlloader - 09-30-2009 , 07:43 AM






Hi all,

I am trying to load the data from a csv file to database.

my data is:

"aaaa","dd\"d"
"hhh","jbbb"

I want it in databse as
aaaa dd"d
hhh jbbb

My control file is:
LOAD DATA INFILE 'SHEET1.csv' TRUNCATE INTO TABLE temp
fields terminated by "," optionally enclosed by '"'
TRAILING NULLCOLS
(aa,bb)

I am using \ as escape character.
but if try to load the data, the data having \" does not get loaded

any pointers will be appreciated.


thanks.

Reply With Quote
  #2  
Old   
sybrandb@hccnet.nl
 
Posts: n/a

Default Re: Escape character while loading data using sqlloader - 09-30-2009 , 01:38 PM






On Wed, 30 Sep 2009 05:43:28 -0700 (PDT), rita <rita.sinkar (AT) gmail (DOT) com>
wrote:

Quote:
Hi all,

I am trying to load the data from a csv file to database.

my data is:

"aaaa","dd\"d"
"hhh","jbbb"

I want it in databse as
aaaa dd"d
hhh jbbb

My control file is:
LOAD DATA INFILE 'SHEET1.csv' TRUNCATE INTO TABLE temp
fields terminated by "," optionally enclosed by '"'
TRAILING NULLCOLS
(aa,bb)

I am using \ as escape character.
but if try to load the data, the data having \" does not get loaded

any pointers will be appreciated.


thanks.

Sql*loader has likely has never known about escape characters and
Oracle has never used the \ as escape characters. You could try to use
the " to escape a ". If that doesn't work, you need to make sure you
are not using a character you plan to load as delimiter, or you need
fixed length data so you don't need any delimiters.

'Does not get loaded' is ambiguous. Make sure you set up a bad file
and a discard file to have the rejected records end up there.

--
--
Sybrand Bakker
Senior Oracle DBA

Reply With Quote
  #3  
Old   
joel garry
 
Posts: n/a

Default Re: Escape character while loading data using sqlloader - 09-30-2009 , 03:18 PM



On Sep 30, 11:38*am, sybra... (AT) hccnet (DOT) nl wrote:
Quote:
On Wed, 30 Sep 2009 05:43:28 -0700 (PDT), rita <rita.sin... (AT) gmail (DOT) com
wrote:



Hi all,

I am trying to load the data from a csv file to database.

my data is:

"aaaa","dd\"d"
"hhh","jbbb"

I want it in databse as
aaaa dd"d
hhh jbbb

My control file is:
LOAD DATA INFILE 'SHEET1.csv' TRUNCATE INTO TABLE temp
fields terminated by "," optionally enclosed by '"'
TRAILING NULLCOLS
(aa,bb)

I am using \ as escape character.
but if try to load the data, the data having \" does not get loaded

any pointers will be appreciated.

thanks.

Sql*loader has likely has never known about escape characters and
Oracle has never used the \ as escape characters. You could try to use
the " to escape a ". If that doesn't work, you need to make sure you
are not using a character you plan to load as delimiter, or you need
fixed length data so you don't need any delimiters.
Perhaps he was looking at
http://download.oracle.com/docs/cd/B....htm#sthref671
Now, that's talking about DDL, but the so"far example seems more
generally to be talking about strings.

Quote:
'Does not get loaded' is ambiguous. Make sure you set up a bad file
and a discard file to have the rejected records end up there.

I know there is an answer, I just can't remember what it is. Perhaps
a badfile will help. Also, setting the the options parameter so it
isn't so silent about errors may help. Maybe specifying options
(silent=(feedback)) on the command line will override the defaults and
give error messages. Boy, I'm rusty with this.

jg
--
@home.com is bogus.
http://www.guardian.co.uk/education/...english-essays

Reply With Quote
  #4  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Escape character while loading data using sqlloader - 10-01-2009 , 04:00 AM



On Sep 30, 8:43*am, rita <rita.sin... (AT) gmail (DOT) com> wrote:
Quote:
Hi all,

I am trying to load the data from a csv file to database.

[]

My control file is:
LOAD DATA INFILE 'SHEET1.csv' TRUNCATE INTO TABLE temp
fields terminated by "," optionally enclosed by '"'
TRAILING NULLCOLS
(aa,bb)

I am using \ as escape character.
but if try to load the data, the data having \" does not get loaded

any pointers will be appreciated.

thanks.
What errors do you get? (my crystal ball has been broken since 1999)

Are you generating the data file with the backslash? Could you
generate it with different enclosing characters instead (and without
the backslash)?

A solution that works is to go to fixed length format.

Ed

Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.