Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Question about UTL_FILE
On Wed, 08 Jun 2005 04:33:12 GMT, "Chris \( Val \)"
<chrisval_at_bigpond.com.au> wrote:
>Hi everyone, I have a question about UTL_FILE that is
>driving me crazy - I just cannot get it to see the
>file.
>
>Firstly the details:
>
>I am using the Oracle 9ir2 personal edition, patched
>at: Release 9.2.0.6.0 on Win XP Pro.
>
>My windows account is added to the "Administrator" group,
>as well as the "ORA_DBA" group, and visa versa.
>
>My Oracle account has DBA, RESOURCE and CONNECT privileges.
>
>I created a directory on my local HDD called: C:\OraTest
>
>In Oracle, I then created the directory as follows:
>
>CREATE DIRECTORY OraTest as 'C:\OraTest'
>
>Directory created.
>
>I then created the most simplest procedures I could think of:
>
>create or replace procedure MyFileReader(
> MyDir in varchar2, MyFile in varchar2 ) as
>
> InFile utl_file.file_type;
> Buffer long;
>
>begin
>
> InFile := utl_file.fopen( MyDir, MyFile, 'r' );
>
> exception
> when utl_file.invalid_path then
> dbms_output.put_line( 'ERROR: Invalid filename or path.' );
>
> utl_file.fclose( InFile );
>
>end;
>/
>
>I then try:
>
>exec MyFileReader( 'OraTest', 'OraFile.txt');
>
>But I always get the "invalid_path" exception being thrown,
>and I can't figure out what I have missed?
>
>I even went to the extent of adding a path directive to the
>"init.ora" file as many would suggest:
>
>utl_file_dir=C:\OraTest
>
>But that did not make a difference, and as far as I know, I
>think I read that this was not even necessary for my version
>of Oracle, right?
>
>This is about the fifth time over a year that I have tried to
>get this working, and I am determined to see it through this
>time, as it really has me annoyed :-)
>
>Any help appreciated.
>
>Thanks,
>Chris Val
>
Change this line:
InFile := utl_file.fopen( MyDir, MyFile, 'r' );
To:
InFile := utl_file.fopen( UPPER(MyDir), MyFile, 'r' );
Hope that helps,
LewisC
Author, ItToolBox Blog: An Expert's Guide to Oracle http://blogs.ittoolbox.com/oracle/guide/
Topic Editor, Suite101.com: Oracle Database http://www.suite101.com/welcome.cfm/oracle
Sign up for courses here:
http://www.suite101.com/suiteu/default.cfm/416752