Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: UTL_FILE Woes
A copy of this was sent to "Mike Criscolo" <mike_at_accretive.com>
(if that email address didn't require changing)
On Fri, 2 Apr 1999 22:59:54 -0500, you wrote:
>Hello,
>
>I'm having a bit of a time getting the UTL_FILE package
>to work under Solaris 2.6. I'm running 7.3.4. I've set
>the utl_file_dir to most everything, including "*", "/tmp",
>and even the home directory of the "oracle" user. To
>no avail. When I run the proc, I get an exception that's
>NOT the standard exceptions thrown during a FOPEN call.
>I check for Invalid Path, Invalid Mode and Invalid Operation.
>I'm landing in the "WHEN OTHERS" clause of my EXCEPTION
>statement.
>
>This same proc runs fine under NT/7.3.4. Is there a trick to
>getting UTL_FILE working under UNIX?
>
>Thanks,
>-Mike
>
Can you run the following script and show us the output:
column value format a40
select value from v$parameter where name like 'utl_file%';
declare
g_invalid_path_msg constant varchar2(255) default
'INVALID_PATH: File location or filename was invalid.';
g_invalid_mode_msg constant varchar2(255) default
'INVALID_MODE: The open_mode parameter in FOPEN was invalid.';
g_invalid_filehandle_msg constant varchar2(255) default
'INVALID_FILEHANDLE: The file handle was invalid.';
g_invalid_operation_msg constant varchar2(255) default
'INVALID_OPERATION: The file could not be opened or operated on as requested.';
g_read_error_msg constant varchar2(255) default
'READ_ERROR: An operating system error occurred during the read operation.';
g_write_error_msg constant varchar2(255) default
'WRITE_ERROR: An operating system error occurred during the write operation.';
g_internal_error_msg constant varchar2(255) default
'INTERNAL_ERROR: An unspecified error in PL/SQL.';
l_output utl_file.file_type; begin
l_output := utl_file.fopen( '/tmp', 'foo.txt', 'w' );
utl_file.fclose( l_output );
exception
when utl_file.invalid_path then raise_application_error(-20001,g_invalid_path_msg); when utl_file.invalid_mode then raise_application_error(-20002,g_invalid_mode_msg); when utl_file.invalid_filehandle then raise_application_error(-20002,g_invalid_filehandle_msg); when utl_file.invalid_operation then raise_application_error(-20003,g_invalid_operation_msg); when utl_file.read_error then raise_application_error(-20004,g_read_error_msg); when utl_file.write_error then raise_application_error(-20005,g_write_error_msg); when utl_file.internal_error then raise_application_error(-20006,g_internal_error_msg);end;
On my solaris/7.3.4 combo i get:
SQL> @uf
VALUE
PL/SQL procedure successfully completed.
show it working...
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA
--
http://govt.us.oracle.com/ -- downloadable utilities