Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Open files with accents with BFILENAME under windows

606456Sep 10 2009 — edited Aug 27 2012
hello,

I need to load a bunch of files from a DIRECTORY under a windows environment and everything is going fine, but some of these files contains spaces. Trying to open these files cause the ORA-22288 error!

We have a relatively large amount of files with spaces, so I don't want to rename these one and I want my procedure to handle any kind of files including this case. The directory is feeded by external users and I can't control de naming of files.

How can I load files containing spaces?
As last resort, I can try to rename files replacing spaces by other characters like «.» or «_».

here is my code snippet, if there's a better way to do don't hesitate:
DECLARE
   l_bfile     BFILE;
   l_blob      BLOB;
BEGIN
      UPDATE    documents
            SET blob_value = EMPTY_BLOB()
          WHERE doc_id = files_row.doc_id
         RETURN blob_value
           INTO l_blob; 

      l_bfile := BFILENAME ('DIRNAME', 'File with spaces.doc');
      DBMS_LOB.fileopen (l_bfile, DBMS_LOB.file_readonly); -- using the OPEN function is recommended for new development
      DBMS_LOB.loadfromfile (l_blob, l_bfile, DBMS_LOB.getlength (l_bfile));
      DBMS_LOB.fileclose (l_bfile);
END;
Thanks
Bruno
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 24 2012
Added on Sep 10 2009
7 comments
5,943 views