Re: Why is UTL_FILE.FOPEN failing?

From: Thomas Olszewicki <ThomasO_at_cpas.com>
Date: Mon, 16 Apr 2012 06:27:18 -0700 (PDT)
Message-ID: <242afab7-8f36-474d-9183-6c9f8d0cd523_at_n19g2000yqk.googlegroups.com>



On Apr 16, 7:37 am, PeteOlcott <peteolc..._at_gmail.com> wrote:
> 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.- Hide quoted text -
>
> - Show quoted text -

'c:\' is wrong path on unix server.
Hth
Thomas Received on Mon Apr 16 2012 - 08:27:18 CDT

Original text of this message