Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Help: UTL_FILE package problem
Because I work solely in UNIX, here is how I handle files that I intend to
write with UTL_FILE.
Fullname="$Dirname""/"$Fname;
>$Fullname
if [ $? -ne 0 ];then
print -u2 "Unable to create $Fullname";
exit 1;
fi
The ">" character is important since it creates an empty instance of the file. If I pass successfully through this sequence I know that I have permission to create the file in the specified directory. In addition, I know that my uid/gid is the owner of the file.
2. Then I change permissions on the file so that Oracle can write to the file:
chmod 666 $Fullname
if [ $? -ne 0 ];then
print -u2 "Unable to change permissions for $Fullname";
exit 1;
fi
I then either pass the directory and file name into the pl/sql as parameters or if I am using a here-document I simply use the shell variables within the block. I can then perform utl_file functions knowing that the file already exists with the correct permissions.
The chief advantages to all of this is that error checking is performed external to pl/sql and that I know the ownership of the file.
Ken
Just Visting wrote:
> Does the process owner has write privs for that directory?
> Most likely the process is being run with an owner of "oracle"
> and NOT with your user ID.
>
> As a test point to a "TEMP" directory where EVERYONE has FULL privs.
> Does that work? IF so then more than likely you have a permissions
> problem.
>
> On Sun, 11 Jul 1999 17:08:04 +0200, Graziano <g_nanetti_at_hotmail.com>
> wrote:
>
> >Hi guys,
> >I had a problem using the UTL_FILE package. In particular, when I try to
> >open
> >a file in an existing directory with the following instruction ...
> >
> >hFile := utl_file.fopen('e:\job\fiat\nscc', 'tabla025.txt', 'w');
> >
> >... I get an invalid path exception.
> >What can I do?
> >
> >Thanks in advance ;-)
> >gn
> >
Received on Sun Jul 11 1999 - 16:00:10 CDT
![]() |
![]() |