?
Solved

File generation using utl_file

Posted on 2016-11-13
4
Medium Priority
?
83 Views
Last Modified: 2016-11-15
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
0
Comment
Question by:gs79
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 2000 total points
ID: 41886201
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
 

Author Comment

by:gs79
ID: 41886299
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
 
LVL 74

Expert Comment

by:sdstuber
ID: 41886308
yes, you do the replace regardless of the number of them.
0
 

Author Comment

by:gs79
ID: 41888460
It works. I havent got confirmation from the vendor. Atleast I am able to upload to table where I had problems initially.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and theā€¦
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question