| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL: Sending output to a text file possible ?
You didn't set the init.ora parameter UTL_FILE_DIR needed to run this utility. From the application developers guide:
Server security for PL/SQL file I/O consists of a restriction on the directories that can be accessed. Accessible directories must be specified in the instance parameter initialization file (INIT.ORA). You specify the accessible directories for the UTL_FILE functions in the initialization file using the UTL_FILE_DIR parameter, as follows:
UTL_FILE_DIR = <directory name>
For example, if the initialization file for the instance contains the line UTL_FILE_DIR = /usr/jsmith/my_app then the directory /usr/jsmith/my_app is accessible to the FOPEN function. Note that a directory named /usr/jsmith/My_App would not be accessible on case–sensitive operating systems.
The parameter specification
UTL_FILE_DIR = *
has a special meaning. This entry in effect turns off directory access
checking, and makes any directory accessible to the UTL_FILE
functions.
On 17 Apr 1997 12:01:51 GMT, aak2_at_Ra.MsState.Edu (Atif Ahmad Khan) wrote:
>Steve Phelan <stevep_at_pmcgettigan.demon.co.uk> writes:
>
>> Are you using PL/SQL 2.3? And, if so, have you looked at UTL_FILE I/O
>>package that comes with it?
>
>
>Thanks for pointing to a very useful package. I tried it and ran into a
>small problem :
>
>Here is my code :
>
>DECLARE
> output_file UTL_FILE.FILE_TYPE ;
>
> BEGIN
> output_file := UTL_FILE.FOPEN ('/opt/home/atif/SQL/', 'sales.txt', 'W') ;
> utl_file.fclose (output_file) ;
> END ;
>
>and here is the error I am getting. Using sqlplus to process it.
>I also made sure that utl_file_dir parameter had the right value.
>
>BEGIN
>*
>ERROR at line 1:
>ORA-06510: PL/SQL: unhandled user-defined exception
>ORA-06512: at "SYS.UTL_FILE", line 82
>ORA-06512: at "SYS.UTL_FILE", line 120
>ORA-06512: at line 5
>
>I could be missing something very obvious. Its 7AM and I still haven't
>gone to sleep yet :)
>
>I would appreciate any hints. Thanks
>
>Atif Khan
>aak2_at_ra.msstate.edu
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD
http://govt.us.oracle.com/ -- downloadable utilities
![]() |
![]() |