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

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

Re: UTL_FILE problems.

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Wed, 14 May 2003 11:49:16 +0800
Message-ID: <3EC1BCBC.6AEC@yahoo.com>


Ed wrote:
>
> Can someone explain why I am getting ORA-06510 errors from this code
> snippet? I have the appropriate privileges to read from this directory
> (I think).
>
> Thanks In Advance,
> Ed
>
> SQL> list
> 1 create or replace procedure tp2UpdateCodes
> 2 is
> 3 v_line varchar2(128);
> 4 c_location constant varchar2(80) := '/tmp/';
> 5 c_filename constant varchar2(80) := 'tpcodes.txt';
> 6 v_handle Utl_File.File_Type := NULL;
> 7 begin
> 8 v_handle := UTL_FILE.FOPEN ( c_location,
> 9 c_filename,
> 10 'r',
> 11 32767 );
> 12 loop
> 13 Utl_File.Get_Line ( file => v_handle,
> 14 buffer => v_line );
> 15 Dbms_Output.Put_Line ( v_line || '--' );
> 16 end loop;
> 17 Utl_File.Fclose ( file => v_handle );
> 18 exception
> 19 when no_data_found then null;
> 20* end tp2UpdateCodes;
> SQL> execute tp2UpdateCodes
> BEGIN tp2UpdateCodes; END;
>
> *
> ERROR at line 1:
> ORA-06510: PL/SQL: unhandled user-defined exception
> ORA-06512: at "SYS.UTL_FILE", line 120
> ORA-06512: at "SYS.UTL_FILE", line 293
> ORA-06512: at "ICCONTST2.TP2UPDATECODES", line 8
> ORA-06512: at line 1

Add an exception handler for each of the possible UTL_FILE errors so you can see which utl_file error is occurring

hth
connor

-- 
=========================
Connor McDonald
http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue"
Received on Tue May 13 2003 - 22:49:16 CDT

Original text of this message

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