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: Ed <edreyes77_at_hotmail.com>
Date: 15 May 2003 06:45:36 -0700
Message-ID: <5bb04c8c.0305150545.21cf6f0b@posting.google.com>


Connor McDonald <connor_mcdonald_at_yahoo.com> wrote in message news:<3EC1BCBC.6AEC_at_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

Thanks, I added the exception handler for each of the possible UTL__FILE errors and the problem turned out to be a bad directory name. Evidently, sql does not need or want the trailing "/" at the end of the directory.

Thanks For the Help guys. It was much appreciated.

Ed Received on Thu May 15 2003 - 08:45:36 CDT

Original text of this message

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