本文介绍了ORA-22288:文件或LOB操作FILEOPEN失败.文件名,目录名不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将LOB文件加载到表和ORA-22288中.我在DBMS_LOB.FILEOPEN(src_clob);

I'm trying to load a LOB file to a table and ORA-22288.I fail on DBMS_LOB.FILEOPEN(src_clob);

可能是什么原因?该目录存在并且文件位于目录中.

What can be the cause?The directory exists and file is located in the directory.

我执行以下操作:

  1. 以系统身份连接
  2. 执行以下命令:

  1. Connect as SYSTEM
  2. Execute the following commands:

SQL>create or replace directory MY_DIR as 'C:\oracle\admin\MYDB\create\lob';

SQL>Grant all on directory MY_DIR to MYDBUSER;

以MYDBUSER身份连接并调用过程SQL>LOAD_LOB_FROM_FILE(10,'insert_details_view.xsl','XMLXSL_DATA_T','FILE_ID','LOB_FILE');

Connect as MYDBUSER and call a procedure SQL>LOAD_LOB_FROM_FILE(10,'insert_details_view.xsl','XMLXSL_DATA_T','FILE_ID','LOB_FILE');

过程是:

CREATE OR REPLACE PROCEDURE LOAD_LOB_FROM_FILE(p_FileId  NUMBER, p_FileName  
VARCHAR2,p_TableName VARCHAR2, p_IDColumnName VARCHAR2, p_FileColoumnName VARCHAR2)
IS
    dest_clob   CLOB;
    src_clob    BFILE  := BFILENAME('MY_DIR', p_FileName);
    dest_length number;
    str_query   CLOB;

BEGIN

  -- This procedure handles updates of all files in the databse - LOB, Json and XSL.
  -- The procedure recieves dynamic parameters in order to work for all contexts and file types
  str_query := 'SELECT ' || p_FileColoumnName || ' FROM ' || p_TableName || ' WHERE ' || p_IDColumnName || ' = ' || p_FileId || ' FOR UPDATE ';

  EXECUTE IMMEDIATE str_query INTO dest_clob;

  DBMS_LOB.FILEOPEN(src_clob);

  -- It is necessary to clear the old clob before updating with the new one to prevent the file destruction.
  dest_length := DBMS_LOB.GETLENGTH(dest_clob);
  IF dest_length <> 0 THEN
      DBMS_LOB.ERASE(dest_clob,dest_length,1);
  END IF;

  DBMS_LOB.LOADFROMFILE(dest_clob,src_clob,DBMS_LOB.GETLENGTH(src_clob));

  str_query := 'UPDATE ' || p_TableName || ' SET ' || p_FileColoumnName || ' = ''' || dest_clob ||''' WHERE ' || p_IDColumnName || ' = ' || p_FileId;

  EXECUTE IMMEDIATE str_query;
  DBMS_LOB.FILECLOSE(src_clob);
  COMMIT;
END;
/

完整错误堆栈:

第1行出现错误:ORA-22288:文件或LOB操作FILEOPEN失败文件名,目录名称或卷标签语法不正确.

ERROR at line 1:ORA-22288: file or LOB operation FILEOPEN failedThe filename, directory name, or volume label syntax is incorrect.

ORA-06512:位于"SYS.DBMS_LOB",第805行

ORA-06512: at "SYS.DBMS_LOB", line 805

ORA-06512:位于"VSU22.LOAD_LOB_FROM_FILE"的第16行

ORA-06512: at "VSU22.LOAD_LOB_FROM_FILE", line 16

ORA-06512:在第3行

ORA-06512: at line 3

推荐答案

传递给使用的安装程序的参数不正确(请注意).

The parameter passed to the installer used was incorrect (lack of attention).

这篇关于ORA-22288:文件或LOB操作FILEOPEN失败.文件名,目录名不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 23:11