create or replace directory asdf as '/users/oracle/db_compare_tool/com_pro_dir';
create or replace procedure test_output is
v_file utl_file.file_type;
begin
v_file:=utl_file.fopen('asdf','asdf.sql','a');
utl_file.put_line(v_file, 'okokokokok;');
utl_file.fclose(v_file);
end test_output;
我这样用时报错ORA-29280:目录路径无效(invalid directory path)
将语句“v_file:=utl_file.fopen('asdf','asdf.sql','a')”中asdf改为大写ASDF,(create directory语句中可以不用改)就可以了。虽说PL/SQL语句不区分大小写,但看来此处是个例外。
v_file:=utl_file.fopen('ASDF','asdf.sql','a');
我用的版本是Oracle Database 10g Enterprise Edition Release 10.2.0.2.0。
小记一下。