Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: UTL_FILE

Re: UTL_FILE

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Tue, 04 Jun 2002 15:14:58 GMT
Message-ID: <3CFCD96B.9955B70C@exesolutions.com>


Gerrit Krull wrote:

> can anyone tell me why I get this messages no matter what path or filename I enter?
>
> Thx and BR,
>
> Gerrit
>
> SQL> ed
> Wrote file afiedt.buf
>
> 1 declare
> 2 v_file UTL_FILE.FILE_TYPE;
> 3 begin
> 4 v_file := utl_file.fopen('C:\Temp', 'Test.Txt', 'w');
> 5 utl_file.put_line(v_file, 'Test');
> 6 utl_file.fclose(v_file);
> 7* end;
> SQL> /
> declare
> *
> ERROR at line 1:
> ORA-06510: PL/SQL: unhandled user-defined exception
> ORA-06512: at "SYS.UTL_FILE", line 98
> ORA-06512: at "SYS.UTL_FILE", line 157
> ORA-06512: at line 4

Because your error handling is inadequate. ;-)

Most likely the problem is that you are never getting the file opened at line 4. Comment out the rest and see if you still get the error.

If you do put this at the bottom of the procedure:

EXCEPTION
   WHEN utl_file.invalid_mode THEN

      vMessage := vProcName || ' Has Failed With ERROR -20051, Invalid Mode';
      DBMS_OUTPUT.PUT_LINE(vMessage);
   WHEN utl_file.invalid_operation THEN
      vMessage := vProcName || ' Has Failed With ERROR -20054, Invalid Operation';
      DBMS_OUTPUT.PUT_LINE(vMessage);
   WHEN utl_file.invalid_path THEN
      vMessage := vProcName || ' Has Failed With ERROR -20052, Invalid Path';
      DBMS_OUTPUT.PUT_LINE(vMessage);

END; You will know which error opening the file is the exact problem.

And did you put UTL_FILE_DIR = 'c:\temp' into your init.ora and bounce the instance before trying to use utl_file?

Daniel Morgan Received on Tue Jun 04 2002 - 10:14:58 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US