Re: Why is UTL_FILE.FOPEN failing?

From: PeteOlcott <peteolcott_at_gmail.com>
Date: Mon, 16 Apr 2012 04:37:28 -0700 (PDT)
Message-ID: <0b3060ee-ed13-4736-94f9-995c955c6603_at_f17g2000yqj.googlegroups.com>


[Quoted] [Quoted] On Apr 13, 1:10 pm, ddf <orat..._at_msn.com> wrote:
> On Apr 12, 9:16 am, PeteOlcott <peteolc..._at_gmail.com> wrote:
>
>
>
>
>
> > INPUT:
> > create or replace directory filesdir as 'c:\';
> > grant read on directory filesdir to public;
>
> > declare
> >  namesfile UTL_FILE.FILE_TYPE;
> > begin
> >  --  Syntax : FOPEN ( directory alias, filename, open mode)
> >  namesfile  := UTL_FILE.FOPEN('FILESDIR','CASELIST.TXT','r');
> > end;
>
> > OUTPUT:
>
> > SQL> create or replace directory filesdir as 'c:\';
>
> > Directory created.
>
> > SQL> grant read on directory filesdir to public;
>
> > Grant succeeded.
>
> > SQL>
> >   1  declare
> >   2   namesfile UTL_FILE.FILE_TYPE;
> >   3  begin
> >   4   --  Syntax : FOPEN ( directory alias, filename, open mode)
> >   5   namesfile  := UTL_FILE.FOPEN('FILESDIR','CASELIST.TXT','r');
> >   6* end;
> >   7  /
> > declare
> > *
> > ERROR at line 1:
> > ORA-29283: invalid file operation
> > ORA-06512: at "SYS.UTL_FILE", line 488
> > ORA-29283: invalid file operation
> > ORA-06512: at line 5
>
> I'll ask the obvious question:  Does c:\CASELIST.TXT exist?  I doubt
> that it does:
>
> SQL> $ls c:\caselist.txt
> ls: c:\caselist.txt: No such file or directory
>
> SQL>
> SQL> declare
>   2   namesfile UTL_FILE.FILE_TYPE;
>   3  begin
>   4           --  Syntax : FOPEN ( directory alias, filename, open
> mode)
>   5   namesfile  := UTL_FILE.FOPEN('FILESDIR','CASELIST.TXT','r');
>   6  end;
>   7  /
> declare
> *
> ERROR at line 1:
> ORA-29283: invalid file operation
> ORA-06512: at "SYS.UTL_FILE", line 536
> ORA-29283: invalid file operation
> ORA-06512: at line 5
>
> SQL>
> SQL> $touch c:\caselist.txt
>
> SQL>
> SQL> declare
>   2   namesfile UTL_FILE.FILE_TYPE;
>   3  begin
>   4           --  Syntax : FOPEN ( directory alias, filename, open
> mode)
>   5   namesfile  := UTL_FILE.FOPEN('FILESDIR','CASELIST.TXT','r');
>   6  end;
>   7  /
>
> PL/SQL procedure successfully completed.
>
> SQL>
>
> David Fitzjarrell- Hide quoted text -
>
> - Show quoted text -

The unix command "$ls" does not work on unix, when in sqlplus.

SQL> $ls CASELIST.txt
SP2-0734: unknown command beginning "$ls CASELI..." - rest of line ignored.

The oracle database is stored on a unix server. Received on Mon Apr 16 2012 - 13:37:28 CEST

Original text of this message