Use the function version of fopen when you want to retrieve and use the file handle. Otherwise, you can simply call either of the procedure versions to open the file and not worry about declaring a file handle.
The fclose and fclose_all procedures may be used to close one or all files. Their headers are:
Notice that there is no overloading of the fclose program. Until a reader or the author enhances PLVfile to maintain a PL/SQL table of opened file names and their handles, there is no way to close a file by name. The fclose_all procedure is a passthrough to UTL_FILE.FCLOSE_ALL, which shuts down any files that have been opened with the UTL_FILE.FOPEN program.
You may find it useful to include a call to fclose or, more likely, fclose_all, in the exception sections of programs that work with PLVfile. That way if your program fails during file manipulation, it will not leave a file open. If the file is left open, that could cause another, different error, the next time you try to run it.
Copyright (c) 2000 O'Reilly & Associates. All rights reserved.