13.6 Writing to a File

Chapter 13
PLVfile: Reading and Writing Operating System Files
 

When you open a file in write-only mode (PLVfile.c_write) or append mode (PLVfile.c_append), you usually then want to write or put a line into that file. To do this, you will call the PLVfile.put_line procedure, whose header is shown below:

PROCEDURE put_line    (file_in IN UTL_FILE.FILE_TYPE, line_in IN VARCHAR2);

Notice that you must provide a file handle to put a line in a file. You must, therefore, have already opened the file using one of the function versions of fopen.

13.6.1 Appending a Line

The append_line procedure offers a quick way to add a line on to the end of a file. Its header is:

PROCEDURE append_line (file_in IN VARCHAR2, line_in IN VARCHAR2);

You provide the file and the line you want appended on the end of the file. PLVfile automatically opens the file in append mode, writes the line using put_line, and then closes the file.


13.5 Reading From a File13.7 Copying File Contents

Copyright (c) 2000 O'Reilly & Associates. All rights reserved.



Advanced Oracle PL. SQL Programming with Packages
Advanced Oracle Pl/Sql: Programming With Packages (Nutshell Handbook)
ISBN: B00006AVR6
EAN: N/A
Year: 1995
Pages: 195
Authors: Steven Feuerstein, Debby Russell
BUY ON AMAZON

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net