加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

oracle – ORA-29283:无效的文件操作ORA-06512:在“SYS.UTL_FI

发布时间:2020-12-12 16:30:08 所属栏目:百科 来源:网络整理
导读:下面是我用来从表格中提取数据到平面文件的代码. BEGIN DECLARE file_name VARCHAR2(50); file_handle utl_file.file_type;BEGIN file_name := 'table.txt'; file_handle := utl_file.fopen('SEND',file_name,'W');FOR rec in( SELECT column 1 ||'~'||colum
下面是我用来从表格中提取数据到平面文件的代码.
BEGIN
    DECLARE
        file_name VARCHAR2(50);
        file_handle utl_file.file_type;
BEGIN
    file_name := 'table.txt';
    file_handle := utl_file.fopen('SEND',file_name,'W');
FOR rec in(
    SELECT            column 1
                ||'~'||column 2
                ||'~'||column 3 out_line
    FROM table1)LOOP
UTL_FILE.PUT_LINE(file_handle,rec.out_line);
UTL_FILE.FFLUSH(file_handle);
END LOOP;
UTL_FILE.FCLOSE(file_handle);
END;
end;

这段代码在我们的开发数据库中工作正常,但是如果我在新的数据库中执行它会抛出以下错误.

Error starting at line 1 in command:
    BEGIN
    DECLARE
        file_name VARCHAR2(50);
        file_handle utl_file.file_type;
BEGIN
    file_name := 'table.txt';
    file_handle := utl_file.fopen('SEND',rec.out_line);
UTL_FILE.FFLUSH(file_handle);
END LOOP;
UTL_FILE.FCLOSE(file_handle);
END;
end;

Error report:
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE",line 536
ORA-29283: invalid file operation
ORA-06512: at line 7
29283. 00000 -  "invalid file operation"
*Cause:    An attempt was made to read from a file or directory that does
           not exist,or file or directory access was denied by the
           operating system.
*Action:   Verify file and directory access privileges on the file system,and if reading,verify that the file exists.
Oracle directory 'SEND' points to some UNIX directory which has rights as 
       'rwxrwsr-x' (Octal 2775)
Oracle Version:11g

请帮我解决这个问题.

如果您需要我提供更多数据来解决这个问题,请大家告诉我们.

因此,@ Vivek通过评论中的对话而不是通过实际答案来解决问题.谁说SO是Q& A网站而不是论坛?呃,我,等等.

无论如何,在没有接受这个问题的答案的情况下,我提供了一个关于UTL_FILE.FOPEN()主题的链接. Find it here.

附:我将这个答案标记为社区Wiki,因为它不是这个问题的正确答案,只是重定向到其他地方.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读