Solved

UTL_FILE.PUT_LINE question

Posted on 2011-02-18
3
767 Views
Last Modified: 2013-12-19
I am creating a comma delimited text file (i.e a 'csv' file) using the utl_file.put_line. When I open the resulting file in 'notepad' the data is one contigous line (i.e. no cr/lf), but when I open the file in other editors like UltraEdit the cr/lf are there.
Has anyone come accross this before?
0
Comment
Question by:SpyHop
3 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 34929636
From the docs:

PUT_LINE terminates the line with the platform-specific line terminator character or characters.

http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/u_file.htm#ARPLS70942

Notepad isn't all that smart and PUT_LINE might not be writing an actual cr/lf.  It might just be one or the other.

To check this theory, open the file in a hex editor and look at what PUT_LINE is writing.
0
 
LVL 73

Assisted Solution

by:sdstuber
sdstuber earned 25 total points
ID: 34929650
are you sure you're writing both characters?  chr(13) and chr(10)  

Note pad requires both,  other, smarter editors, like Ultraedit recognize other end-of-line conventions and display accordingly
0
 
LVL 34

Accepted Solution

by:
johnsone earned 25 total points
ID: 34929754
Sounds typical of a file generated on a UNIX server and then brought over to a Windows system.

If you use ftp to transfer the file between the 2 operating systems, be sure you do it in ASCII mode, that will do the end of line transformation for you during the transfer.  Even programs that attempt to detect the file type don't always get it right, don't rely on automatic, always specify the type.  If you are using a command line ftp to transfer the file, the command it typically "TYPE ASCII", however it does very.

Wordpad is also an editor that will open the file correctly.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now