Oracle
  Home arrow Oracle arrow Page 6 - Writing to Text Files in Oracle PL/SQL
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM Developerworks
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ORACLE

Writing to Text Files in Oracle PL/SQL
By: Jagadish Chatarji
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 61
    2006-04-18

    Table of Contents:
  • Writing to Text Files in Oracle PL/SQL
  • How to count the number of lines from the text file
  • How to copy the information from a text file into a table using PL/SQL
  • How to write into a text file from PL/SQL
  • How to copy from a table into the text file from PL/SQL
  • Other ways to write the information into a text file from PL/SQL

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    PCmover - $15 Off with Coupon Code CJPH7Q

    Writing to Text Files in Oracle PL/SQL - Other ways to write the information into a text file from PL/SQL
    (Page 6 of 6 )

    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


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Hello guys. You can work with text files very easily from within Oracle PL/SQL. ...
       · Hi,I have a problem regarding writing to text files.I am using spooling now and...
     

       

    ORACLE ARTICLES

    - Tuning PL/SQL Code
    - Debugging PL/SQL Code
    - Testing PL/SQL Code
    - Working With PL/SQL Code
    - Conditional Compilation for Oracle Database ...
    - Compile-Time Warnings for Oracle DB 10g
    - Compiling PL/SQL Code for an Oracle Database
    - Troubleshooting PL/SQL Code
    - Managing PL/SQL Code
    - Data Manipulation and More for HTML DB Appli...
    - Oracle Database Fundamentals
    - Adding Processes to HTML DB Applications
    - Adding Computations, Processes, and Validati...
    - Sub-templates and More with Oracle HTML DB
    - Focusing on Templates in Oracle HTML DB

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway