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:
When you call fcreate , it "initializes" a file to the line you provide (or the default line value) and then it closes the file if you have called the procedure version of fcreate . On the other hand, if you have called the fcreate function, PLVfile returns the handle to the file and then keeps the file open.
Perhaps you only want to create a file if it already exists. PLVfile offers the fexists function to provide you with this information. The headers for this overloaded function are:
You can provide separate locations and file names, or simply pass in the single string with combined information. The function returns TRUE if the file can be opened for read-only access successfully. If the file is already open, this function will return FALSE -- so use fexists with care.
Copyright (c) 2000 O'Reilly & Associates. All rights reserved.