File generation using utl_file

i am generating a file using utl file package via plsql. I am wrapping each field with double quotes and seperating by comma. The generated file has problems when the vendor is trying to upload to their site.

iI tried to upload the generated file to google fusion table and it pointed me to the record where the problem was.

one of the field has double quote in it. something like this

field 1   field 2
ab"cd     xyz

Is there a special way to handle when there is an actual doule quote in the field. I know that in sqlloader you can specify occacionally enclosed by doule quotes while uploading. But how do i handle it while generating the file from database when the value contains double quote in it

thanks
gs79Asked:
Who is Participating?
 
sdstuberConnect With a Mentor Commented:
replace all double-quotes within a column with 2 double-quotes.

select replace(your_column,'"','""') from your_table

Open in new window



so, if you data looks like this...  

He said "Hello" to me.

You would export it like this "He said ""Hello"" to me."
0
 
gs79Author Commented:
The record in questiom has only one double quote. There is no closing double quote. Will it work for this scenario as well? i will try tho when i get to office. Thought i ask
0
 
sdstuberCommented:
yes, you do the replace regardless of the number of them.
0
 
gs79Author Commented:
It works. I havent got confirmation from the vendor. Atleast I am able to upload to table where I had problems initially.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.