Home arrow Oracle arrow Page 6 - Writing to Text Files in Oracle PL/SQL

Other ways to write the information into a text file from PL/SQL - Oracle

This is the second article in a series focusing on file input/output using Oracle PL/SQL packages.

  1. Writing to Text Files in Oracle PL/SQL
  2. How to count the number of lines from the text file
  3. How to copy the information from a text file into a table using PL/SQL
  4. How to write into a text file from PL/SQL
  5. How to copy from a table into the text file from PL/SQL
  6. Other ways to write the information into a text file from PL/SQL
By: Jagadish Chatarji
Rating: starstarstarstarstar / 139
April 18, 2006

print this article



Until now we have seen how to read and write text files from within PL/SQL.  This section simply gives you a few more tips on writing text files efficiently.

Everyone by now would know what the “utl_file.put_line” is doing.  It simply adds a new line to the text file.  In fact, it types the entire line that we asked into the text file and also writes a “carriage return line feed” character as well.  Put simply, the “carriage return line feed” character is very similar to the character of the “enter” key, when you press it in Notepad. 

We also have another option we can use to write into the text file, which is “utl_file.put.”  It is very similar to the “utl_file.put_line” except that it does not write a “carriage return line feed” character any more.  This can be helpful if you wanted to write a single line to the text file from multiple PL/SQL statements.  You can even manually go to the next line using “utl_file.new_line.”

All the examples in this article have been tested only with Oracle 10g version 2 on Windows Server 2003 standard edition. The examples would be a bit different in  non-Windows environments.  I request that you refer to your DBA or manuals covering the specific platform on which you are going to work. 

I am confident enough that all of the examples should give no problem when worked with Oracle version 7.3 or above (on Windows).  You can drop (or post) me a line if you do experience an issue.  The examples can be directly copied, pasted and tested in your favorite PL/SQL environment.  They should work without any change.

In my upcoming article I may also introduce you to some of the professional ways to deal with the same issues.  Don’t forget to keep an eye on this website for the next article (or simply sign up for a newsletter).  Any comments, suggestions, feedback, bugs, errors, enhancements are highly appreciated at jag_chat@yahoo.com

>>> More Oracle Articles          >>> More By Jagadish Chatarji

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Oracle Java Security Woes Continue
- Oracle's New IaaS Cloud Option: There's a Ca...
- Oracle Acquires Eloqua to Boost Cloud Presen...
- Choosing Innovation: Oracle Survey Insights
- Oracle Fixes Privilege Escalation Bug
- Oracle`s Communications Service Availability...
- Oracle Releases Exalytics, Taleo Plans
- Oracle Releases Communications Network Integ...
- Oracle Releases Communications Data Model 11...
- Oracle Releases PeopleSoft PeopleTools 8.52
- Oracle Integrates Cloudera Apache Distro, My...
- Oracle Releases MySQL 5.5.18
- Oracle Announces NoSQL Database Availability
- Sorting Database Columns With the SELECT Sta...
- Retrieving Table Data with the LIKE Operator

Developer Shed Affiliates


Dev Shed Tutorial Topics: