Loading external files into oracle database

吃可爱长大的小学妹 提交于 2019-12-25 04:22:44

问题


I have created the below table.

create table emps( id varchar2(20), clobi clob);

Am trying to insert bfile into the COLBI column using the below procedure:

create or replace procedure bfii is 
   bfil bfile; 
   clo clob; 
begin 
   insert into emps values('3',empty_clob() ) returning clobi into clo;
   bfil := bfilename('clobr', 'Man.ext'); 
   dbms_lob.fileopen(bfil); 
   dbms_lob.loadfromfile(clo,bfil, dbms_lob.getlength(bfil)); 
   dbms_lob.fileclose(bfil); 
end; 

But I'm getting the error message at run-time rather than compilation.

Error at line 2
ORA-22285: non-existent directory or file for FILEOPEN operation
ORA-06512: at "SYS.DBMS_LOB", line 805
ORA-06512: at "SYS.HIMA", line 12
ORA-06512: at line 2

Can someone help me on this.


回答1:


Directory names, like other objects, are created as uppercase by default unless the name was quoted. When you refer to the directory as a string it needs to match the case in the data dictionary (e.g. all_directories). So you need to change to:

   bfil := bfilename('CLOBR', 'Man.ext'); 

... even if you created it with create directory clobr ...




回答2:


Try to create directory where your Man.ext file is stored



来源:https://stackoverflow.com/questions/25160990/loading-external-files-into-oracle-database

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!