问题
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