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
Solved

UTL_FILE.PUT_LINE question

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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

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 …
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

860 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