Advanced Oracle PL/SQL Programming with Packages

Advanced Oracle PL/SQL Programming with PackagesSearch this book
Previous: 13.5 Reading From a FileChapter 13
PLVfile: Reading and Writing Operating System Files
Next: 13.7 Copying File Contents
 

13.6 Writing to a File

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.


Previous: 13.5 Reading From a FileAdvanced Oracle PL/SQL Programming with PackagesNext: 13.7 Copying File Contents
13.5 Reading From a FileBook Index13.7 Copying File Contents

The Oracle Library Navigation

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

Library Home Oracle PL/SQL Programming, 2nd. Ed. Guide to Oracle 8i Features Oracle Built-in Packages Advanced PL/SQL Programming with Packages Oracle Web Applications Oracle PL/SQL Language Pocket Reference Oracle PL/SQL Built-ins Pocket Reference