ORA-29280与utl_file.fremove()

时间:2015-02-14 11:16:50

标签: oracle

我创建了该文件夹的完全访问权限,但它显示错误。我不知道错误在哪里。我该如何解决这个问题?

create or replace directory Utl_fileoption as 'd:\jk1';

DECLARE 
  filepath VARCHAR2(32767);
  F1 UTL_FILE.FILE_TYPE; 
  Location1 Varchar(500);
BEGIN
  Location1:='Utl_fileoption';
  filepath:='jk.xls';
  UTL_FILE.FREMOVE(Location1,filepath);
END;

错误报告:

ORA-29280: invalid directory path
ORA-06512: at "SYS.UTL_FILE", line 251
ORA-06512: at "SYS.UTL_FILE", line 1230
ORA-06512: at line 9
29280. 00000 - "invalid directory path"

*Cause: A corresponding directory object does not exist.
*Action: Correct the directory object parameter, or create a corresponding
directory object with the CREATE DIRECTORY command. 

1 个答案:

答案 0 :(得分:2)

默认情况下,目录名称与其他对象一样,创建为大写,除非引用了名称。当您将目录称为字符串时,它需要匹配数据字典中的大小写(例如all_directories)。所以你需要改为:

Location1:='UTL_FILEOPTION';

...即使您使用create directory Utl_fileoption ...

创建了它