utl_file

SQL> show user;
USER is "HXG"
SQL> show parameter utl_file

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
utl_file_dir string
SQL> create directory dir_test as '/u01/oradata';

Directory created.

SQL> drop directory dir_test;

Directory dropped.

SQL> create directory dir_test as '/u01/oradata/dir_test1';

Directory created.

SQL> declare
2 fn utl_file.file_type;
3 begin
4 fn:=utl_file.fopen('dir_test','test.txt','W');
5 utl_file.fclose(fn);
6 end;
7 /
declare
*
ERROR at line 1:
ORA-29280: invalid directory path
ORA-06512: at "SYS.UTL_FILE", line 33
ORA-06512: at "SYS.UTL_FILE", line 436
ORA-06512: at line 4


SQL> declare
2 fn utl_file.file_type;
3 begin
4 fn:=utl_file.fopen('DIR_TEST','test.txt','W');
5 utl_file.fclose(fn);
6 end;
7 /

PL/SQL procedure successfully completed.

SQL>

你可能感兴趣的:(File)