Solved

UTL_FILE.PUT_LINE question

Posted on 2011-02-18
3
770 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Migrating an SQL 2008 database to Oracle 12c 3 88
sql query 9 37
Fastest way to replace data in Oracle 5 50
Consolidating oracle query results to a single line 8 52
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
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

947 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

21 Experts available now in Live!

Get 1:1 Help Now