我试图将LOB文件加载到表和ORA-22288。
我在DBMS_LOB.FILEOPEN(src_clob);
可能是什么原因? 目录存在,文件位于目录中。
我执行以下操作:
执行以下命令:
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');
程序是:
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失败 文件名,目录名或卷标语法不正确。
ORA-06512:at&#34; SYS.DBMS_LOB&#34;,805行
ORA-06512:at&#34; VSU22.LOAD_LOB_FROM_FILE&#34;,第16行
ORA-06512:第3行
答案 0 :(得分:0)
传递给使用的安装程序的参数不正确(没有注意)。