সোমবার, ২০ জুলাই, ২০২০

Physical file existence check

DECLARE
  l_file_exists BOOLEAN;
  l_file_len    NUMBER;
  l_blocksize   BINARY_INTEGER;
BEGIN
  utl_file.fgetattr(
    location    => 'UTL_DIR',
    filename    => 'MM.TXT',
    fexists     => l_file_exists,
    file_length => l_file_len,
    block_size  => l_blocksize);
  IF l_file_exists THEN
    dbms_output.put_line('File found, size=' || l_file_len);
  ELSE
    dbms_output.put_line('File not found.');
  END IF;
END;