9 Replies Latest reply: May 6, 2010 12:32 PM by 265441 RSS

    util_file.fgetattr    'file does not exist'

    265441
      Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
      PL/SQL Release 11.1.0.7.0 - Production
      CORE 11.1.0.7.0 Production
      TNS for 32-bit Windows: Version 11.1.0.7.0 - Production
      NLSRTL Version 11.1.0.7.0 - Production


      The file exists and thesqldr uses this file. Here is my code.

      set serveroutput on


      DECLARE


      v_dir VARCHAR2(200); -- Directory containing the data file
      v_filename VARCHAR2(100); -- Data filename
      v_file_exists boolean;
      v_file_length number;
      v_block_size number;


      BEGIN

      v_dir := '\\nrs2\WEBSITE\INCOMING\STARPUBS\';
      v_filename := 'PC.ORDERS';

      DBMS_OUTPUT.PUT_LINE(v_filename); --shows filename
      DBMS_OUTPUT.PUT_LINE(v_dir); --shows directory

      utl_file.fgetattr(v_dir, v_filename, v_file_exists, v_file_length ,v_block_size );

      IF v_file_exists THEN
      dbms_output.put_line('File Exists');
      ELSE
      dbms_output.put_line('File Does Not Exist');
      END IF;

      END;
      /


      Output:

      SQL> @C:\STARPUBS\STARPUBS\dataformats\sql\fileOrderscheck.sql
      PC.ORDERS
      \\nrs2\WEBSITE\INCOMING\STARPUBS\
      File Does Not Exist

      PL/SQL procedure successfully completed.