看看这个:
FOPEN FunctionThis function opens a file for input or output. The file location must be an accessible
directory, as defined in the instance’s initialization parameter UTL_FILE_DIR. The
complete directory path must already exist; it is not created by FOPEN.语法:UTL_FILE.FOPEN (
location IN VARCHAR2,
filename IN VARCHAR2,
open_mode IN VARCHAR2)RETURN UTL_FILE.FILE_TYPE;location:
Operating system-specific string that specifies the directory in which to open the file.filename:
Name of the file, including extension (file type), without any directory path nformation. (Under the UNIX operating system, the filename cannot be terminated with a /).open_mode:
String that specifies how the file should be opened (either upper or lower case letters can be used).
The supported values, and the UTL_FILE procedures that can be used with them are:
r read text (GET_LINE)
w write text (PUT, PUT_LINE, NEW_LINE, PUTF, FFLUSH)
a append text (PUT, PUT_LINE, NEW_LINE, PUTF, FFLUSH)

解决方案 »

  1.   

    忘记说明了,我在windows2000下面运行oracle的,我如果创建一个 directory 
    create directory  xxx as  "c:\xxx\";
    然后utl_file.fopen(xxx,'ttt.txt',r);
    这样就可以
    但是utl_file.fopen('c:\xxx\','ttt.txt',r);
    就不行。
    who can tell me why.
      

  2.   

    The PL/SQL file I/O feature is available for both client-side and server-side
    PL/SQL. The client implementation (text I/O) is subject to normal operating system
    file permission checking. However, the server implementation may be running in a
    privileged mode, which requires a restriction on the directories that can be accessed.
    Accessible directories must be specified in the instance parameter initialization file
    (INIT.ORA).Accessible directories for the UTL_FILE functions are specified in the initialization
    file using the UTL_FILE_DIR parameter. For example:
    UTL_FILE_DIR = <directory name>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 = * should be used with caution. It
    turns off directory access checking and makes all directories accessible to the UTL_
    FILE functions.
      

  3.   

    UTL_FILE的路径是由init.ora中的UTL_FILE='**'决定的
      

  4.   

    能不能讲一下,如果我想使用绝对路径打开一个文件。要怎么做。系统是win2000。
      

  5.   

    是说要init.ora中UTL_FILE指定的范围内的路径可以操作文件么