My Oracle Support Banner

UTL_FILE Does Not Create a File and No Errors Are Returned (Doc ID 1063852.1)

Last updated on JULY 05, 2017

Applies to:

PL/SQL - Version: 10.2.0.4 - Release: 10.2
Information in this document applies to any platform.

Symptoms

Using a very simple code-block to test the UTL_FILE package to make sure it creates a file properly in the desired directory on the Database server. The script runs successfully but there is no file in the directory.

SQL> create directory TEST_DIR1 as '/tmp';

set serveroutput on

DECLARE
   l_file_handle utl_file.file_type;
   l_file_name varchar2(20) := 'Output.txt';
   l_dir_name varchar2(50) := 'TEST_DIR1';
BEGIN
   dbms_output.enable(1000);
   l_FILE_HANDLE := utl_file.fopen(l_DIR_NAME,l_FILE_NAME,'W');
   IF utl_file.is_open(l_FILE_HANDLE) THEN
      dbms_output.put_line ('File is open');
   END IF;
   utl_file.put_line(l_FILE_HANDLE, 'Hello World');
   utl_file.fclose(l_FILE_HANDLE);
END;
/


Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
  Symptoms
  Cause
  Solution

This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review.

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.