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