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: problems with UTL_FILE

Re: problems with UTL_FILE

From: Tim Cross <tcross_at_pobox.une.edu.au>
Date: 28 Nov 2002 09:50:05 +1100
Message-ID: <87smxm631e.fsf@blind-bat.une.edu.au>


"Mark" <mark.harris.spam.begone_at_ukonline.co.uk.spam.begone> writes:

> Hello,
>
> I'm having problems with UTL_FILE.
>
> Below is a procedure which I'm writing. At the moment, all I'm
> trying to do is to open one file, read the contents of it and
> write it to another.
>
> It's not working in 2 ways.
>
> It's raising a "User-Defined Exception" at the line
>
> UTL_FILE.FCLOSE(vf_write_file);
>
> If I comment out this line, the exception isn't thrown. What's
> confusing me is that I'm not raising *any* user defined
> exceptions within the code.

UTL_FILE raises user defined exceptions for common file operation exceptions. I usually handle them by catching each exception in an exception block and rasing an application error. To make this easier, I have created my own file_op package which is really just a collection of wrappers around the various UTL_FILE procedures/functions, but which throw exceptions which are a little more informative in your applications e.g.

WHEN UTL_FILE.INTERNAL_ERROR THEN

    raise_application_error(-20700, 'Internal Error Exception');
WHEN UTL_FILE.INVALID_MODE THEN 
    raise_application_error(-20701, 'Invalid Mode Exception');
WHEN UTL_FILE.INVALID_PATH THEN

    raise...
...
END; Tim Received on Wed Nov 27 2002 - 16:50:05 CST

Original text of this message

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