Re: UTL_FILE Package

From: Scott Urman <surman_at_dlsun338.us.oracle.com>
Date: 1996/07/25
Message-ID: <4t8t2u$s9_at_inet-nntp-gw-1.us.oracle.com>#1/1


In article <4t83k9$a96_at_rigel.rz.uni-ulm.de>, wzimmer_at_atair.rz.uni-ulm.de (Walter Zimmer) writes:
|> Hi !
|>
|> I just discovered in the Oracle Forms Object Navigator the specification for
|> the UTL_FILE package. Writing to a file is just what I need so I wrote a
|> small PL/SQP Prcedure:
|>
|> PROCEDURE file_test IS
|> file utl_file.FILE_TYPE;
|> BEGIN
|> file := utl_file.fopen('/home/blah, 'test.txt', 'w');
|> utl_file.put(file, 'Yeah !');
|> utl_file.fflush(file);
|> utl_file.fclose(file);
|> EXCEPTION
|> -- exception handling...
|> END;
|>
|> All I get is an exception 'invalid path' from the fopen. I tried hundreds
|> of ways specifying file names and paths, but no success.

You need to specify the accessible directories in the init.ora file. Use the UTL_FILE_DIR parameter. For example

UTL_FILE_DIR='/home/blah'

will allow your example to work. UTL_FILE_DIR=* allows UTL_FILE to write anywhere. Beware of this, though.

|>
|> Anyone knows how to use this Package ?????
|> BTW: Is the file written from the server or clinet where sqlplus is running
|> on ?

The file is written by the shadow process on the server. So the directory where it is written to must be readable by the Oracle owner. For more information, see the Application Developer's Guide or Chapter 11 of _Oracle PL/SQL Programming_ (info below).

|>
|> Thanks,
|> Walter
|>
|> walter.zimmer_at_rz.uni-ulm.de



Scott Urman Oracle Corporation surman_at_us.oracle.com

Author of _Oracle PL/SQL Programming_ ISBN 0-07-882176-2 Published by Oracle Press - http://www.osborne.com/oracle/index.htm

"The opinions expressed here are my own, and are not necessarily that of  Oracle Corporation"
Received on Thu Jul 25 1996 - 00:00:00 CEST

Original text of this message