Solved

UTL_FILE.PUT_LINE question

Posted on 2011-02-18
3
783 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
[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
3 Comments
 
LVL 77

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 74

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 35

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Via a live example, show how to take different types of Oracle backups using RMAN.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

756 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