Skip to Content
Advanced Oracle PL/SQL Programming with Packages
book

Advanced Oracle PL/SQL Programming with Packages

by Steven Feuerstein
October 1996
Intermediate to advanced
687 pages
16h 41m
English
O'Reilly Media, Inc.
Content preview from Advanced Oracle PL/SQL Programming with Packages

13.3. Creating and Checking Existence of Files

PLVfile provides a program (four overloaded versions, actually) to create a file. The headers for fcreate are the following:

FUNCTION fcreate 
   (loc_in IN VARCHAR2, file_in IN VARCHAR2, line_in IN VARCHAR2)
RETURN UTL_FILE.FILE_TYPE;

FUNCTION fcreate (file_in IN VARCHAR2, line_in IN VARCHAR2 := NULL)
RETURN UTL_FILE.FILE_TYPE;

PROCEDURE fcreate 
   (loc_in IN VARCHAR2, file_in IN VARCHAR2, line_in IN VARCHAR2);

PROCEDURE fcreate (file_in IN VARCHAR2, line_in IN VARCHAR2 := NULL);

In versions of fcreate with three arguments, you provide the location, name, and single line to be deposited in the file. Notice that all three values are required. In versions of fcreate with two arguments, you provide the file specification (location and name combined, or just the name, in which case the default directory will be applied).

Notice that the overloading is not only among different parameter lists, but even different program types. I will explain this approach to overloading in PLVfile in this section; you will see it repeatedly throughout the package.

The overloading of fcreate achieves two objectives:

  1. It allows the developer to either obtain the handle to the newly created file (the function versions) or ignore that file handle entirely (the procedure versions). You'll want to retrieve the handle if you plan to perform other actions on that file. If you only want to create the file and then move on to other business, it will be easier and more ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Oracle Database 12c PL/SQL Programming

Oracle Database 12c PL/SQL Programming

Michael McLaughlin
Oracle PL/SQL for DBAs

Oracle PL/SQL for DBAs

Arup Nanda, Steven Feuerstein
Expert PL/SQL Practices for Oracle Developers and DBAs

Expert PL/SQL Practices for Oracle Developers and DBAs

John Beresniewicz, Adrian Billington, Martin Büchi, Melanie Caffrey, Ron Crisco, Lewis Cunningham, Dominic Delmolino, Sue Harper, Torben Holm, Connor McDonald, Arup Nanda, Stephan Petit, Michael Rosenblum, Robyn Sands, Riyaj Shamsudeen

Publisher Resources

ISBN: 1565922387Supplemental ContentCatalog PageErrata