Use UTL_FILE package to create a file : UTL_FILE « System Packages « Oracle PL/SQL Tutorial






SQL>
SQL> CREATE OR REPLACE PROCEDURE fcreate (loc_in IN VARCHAR2, file_in IN VARCHAR2)
  2  IS
  3     fID UTL_FILE.FILE_TYPE;
  4  BEGIN
  5
  6     fID := UTL_FILE.FOPEN (loc_in, file_in, 'W');
  7
  8     UTL_FILE.FCLOSE (fid);
  9  END;
 10  /

Warning: Procedure created with compilation errors.

SQL>
SQL> show error
Errors for PROCEDURE FCREATE:

LINE/COL ERROR
-------- -----------------------------------------------------------------
3/8      PL/SQL: Item ignored
3/8      PLS-00201: identifier 'UTL_FILE' must be declared
6/4      PL/SQL: Statement ignored
6/4      PLS-00320: the declaration of the type of this expression is
         incomplete or malformed

8/4      PL/SQL: Statement ignored
8/21     PLS-00320: the declaration of the type of this expression is
         incomplete or malformed

SQL>








31.38.UTL_FILE
31.38.1.File open and close with UTL_FILE package
31.38.2.File open flags
31.38.3.Save table records to a file
31.38.4.Use UTL_FILE package to create a file
31.38.5.Open a file with mode passed in
31.38.6.utl_file.invalid_&&firstparm
31.38.7.UTL_File related exception
31.38.8.UTL_FILE.IS_OPEN
31.38.9.A PL/SQL block to read an operating system file called BLOB.JPG that contains 1 row of binary data.