Home » SQL & PL/SQL » SQL & PL/SQL » Encoding special characters in a long field for csv file
Encoding special characters in a long field for csv file [message #381211] Thu, 15 January 2009 18:45 Go to next message
anngold
Messages: 9
Registered: July 2006
Junior Member
I'm using PL/SQL to write a query to a .csv file.

One of the fields that is a long datatype field that contains line breaks, carriage returns and commas.

When you view the .csv file within excel all is fine except where the line breaks occur in the code. It causes the line of text (after the line break) to appear on a new line.

I need to encode the following this way:
Newline -> 

Carriage Return -> 
Comma -> ,
Double Quote -> "
Ampersand -> &


I'd normally use replace but that doesn't work on long datatypes. Any ideas on how to do this on a long datatype?

Thanks for your help!
Re: Encoding special characters in a long field for csv file [message #381212 is a reply to message #381211] Thu, 15 January 2009 18:49 Go to previous message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
From the Fine SQL Reference Manual -
LONG Datatype

Do not create tables with LONG columns. Use LOB columns (CLOB, NCLOB, BLOB) instead. LONG columns are supported only for backward compatibility.

Oracle also recommends that you convert existing LONG columns to LOB columns. LOB columns are subject to far fewer restrictions than LONG columns. Further, LOB functionality is enhanced in every release, whereas LONG functionality has been static for several releases. See the modify_col_properties clause of ALTER TABLE and TO_LOB for more information on converting LONG columns to LOB.


You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
So we can help you.

Previous Topic: DBMS_RLS - Reset/Invalidate the static policy predicate
Next Topic: PL/SQL and DB LInk problem
Goto Forum:
  


Current Time: Thu Dec 08 14:27:44 CST 2016

Total time taken to generate the page: 0.14096 seconds