Joinutility seperatorLogin utility separator Infobright.com
   
 
Interpretation of ” as delimiter/enclosing char
Posted: 02 February 2010 02:42 AM   Ignore ]  
Newbie
Rank
Total Posts:  32
Joined  2009-11-09

Hi,

My data file is delimited by ~. There are quite a few free text fields.
While loading one of my data files, I found that if a data field contains “, the data loading aborts with incorrect field specification error.

Upon checking I find that, the particular row in question had a single double quote character (”), basically the closing quote was missing (while other rows with proper pair loaded fine).

Why is this happening ? bug ? or am I missing something ?

Here’s the sample row from file -

596175:1319977~2006/03/03 08:32:01~36059~GM242900~~~~~~375000.0000~337500.0000~123~~ANY STREE
T
~~~~"Some String with proper par"~NY~11762~~~~1141403521329297~C2D~5~2~1~9~~~-1~2~~GM242900~
-
1~~~~~~~~~~~~~~~~~~~~~
1617187~2006/08/08 11:37:06~32003~LIQSA01~312880~~2~312880~2~177000.0000~157500.0000~1060~~MACLEOD~AVE~~~"Some String without pair closed here~NV~89027~~~~1155062226813379~C2D~2~2~1~823~~MID3030365~2~2~PURCHASE~LIQSA01~2~ALLRESIDENTIALTYPES~~0~~~~~~~~~~~~~~~~~~ 

the second line fails to load, whereas the first one loads just fine.

Here’s my command for loading this file…

load data infile '/tmp/t1' into table c1 fields terminated by '~'

Please suggest…

Profile
 
Posted: 02 February 2010 06:47 AM   Ignore ]   [ # 1 ]  
Super Duper Member
Avatar
RankRankRankRankRank
Total Posts:  916
Joined  2008-08-18

Hi !

By default the LOAD DATA command has ENCLOSED BY ‘“’. So the second line contains a long unterminated string. Use

load data infile '/tmp/t1' into table c1 fields enclosed by 'NULL' terminated by '~'
Profile
 
Posted: 03 February 2010 03:50 AM   Ignore ]   [ # 2 ]  
Newbie
Rank
Total Posts:  32
Joined  2009-11-09

worked like a charm. thanks a ton smile

Profile