bfilename, directory problem [message #110095] |
Thu, 03 March 2005 08:28  |
shooter
Messages: 44 Registered: February 2005
|
Member |
|
|
I am using an Oracle PL/SQL function called getClobDocument()
This function is in Oracle XML DB documentation.
When calling the function, using this statement
insert into tableone values( xmltype( getclobdocument( 'doc1.xml', 'UTF-8' ) ) );
the following error crop up:
ORA-22285 non existent directory or file for FILEOPEN operation
I have created a directory and gave it the public grant read privileges. The error is probably in the statement
file bfile := bfilename( 'xml_dir', filename);
Any ideas on how to solve this issue please?
Below is the code for the function
getclobdocument ( filename in varchar2, charset in varchar2 default NULL )
return CLOB deterministic
is
file bfile := bfilename( 'xml_dir', filename);
charContent CLOB := ' ';
targetfile bfile;
lang_ctx number := DBMS_LOB.default_lang_ctx;
charset_id number := 0;
src_offset number := 1;
dst_offset number := 1;
warning number;
begin
if charset is not null then
charset_id := NLS_CHARSET_ID( charset );
end if;
targetFile := file;
DBMS_LOB.fileopen(targetFile, DBMS_LOB.file_readonly);
DBMS_LOB.LOADCLOBFROMFILE(charContent, targetFile,
DBMS_LOB.getLength(targetFile), src_offset, dst_offset,
charset_id, lang_ctx,warning);
DBMS_LOB.fileclose(targetFile);
return charContent;
end;
|
|
|
Re: bfilename, directory problem [message #110148 is a reply to message #110095] |
Thu, 03 March 2005 13:48   |
dwpember
Messages: 1 Registered: March 2005
|
Junior Member |
|
|
Hi.
If you create a Directory object then this need to be referenced in UPPER_CASE when used in pl/sql file operations. At least it does for UTL_FILE...
Try
file bfile := bfilename( 'XML_DIR', filename);
Oracle reads lower_case directory names as the old-fashioned directory paths which used to be listed in UTL_FILE_DIR init.ora parameter.
HTH
Dave
|
|
|
|