Search notes:

Oracle: UTL_FILE.FOPEN

declare
   fh  utl_file.file_type;
begin

   fh := utl_file.fopen(
            location     => 'THE_DIRECTORY',
            filename     => 'the-file.txt',
            open_mode    => 'r'
	 );

   if utl_file.is_open(fh) then
      dbms_output.put_line('file is open');
   else
      dbms_output.put_line('file is closed');
   end if;

   utl_file.fclose(fh);

   if utl_file.is_open(fh) then
      dbms_output.put_line('file is open');
   else
      dbms_output.put_line('file is closed');
   end if;

end;
/

See also

utl_file

Index