http://www.perlmonks.org?node_id=129823


in reply to How do I access Oracle B Files

This question is pretty vauge, but here it goes...
In ORACLE, binary files are housed in a couple of different formats. LOB, BLOB, CLOB are all pretty much the same in that they hold the binary information in the database itself. BFiles are basically, as you said, pointers to files on the OS. I assume your question is that you want to populate a table with some BFiles, and not that you want to get the files actually on the database itself (BLOB).
Use of the function
BFILENAME(<directory handle>, '<filename>')
will return a handle to the bfile that you can then INSERT into the table. One thing about the <directory handle> parameter...
In your init.ora file in your Oracle Home you need to include the line
UTL_FILE_DIR = <path>

You then need to have give the directory a handle by using the following SQL:
CREATE OR REPLACE DIRECTORY <directory handle> AS '<path>'
You can check that the directory handle was made by:
SELECT * FROM sys.user_directories
It is this directory handle that you have to send to BFILENAME to tload the file pointer into the Database.