Oracle System Function - Oracle/PLSQL BFILENAME Function

This Oracle tutorial explains how to use the Oracle/PLSQL function.

The Oracle/PLSQL BFILENAME function returns a BFILE locator for a file.


The syntax for the Oracle/PLSQL BFILENAME function is:

BFILENAME( 'directory', 'filename' )

directory is a directory object that serves as an alias for the full path.

filename is the name of the file on the file server.


First, we create a directory called exampleDir that points to /example/tutorial on the server.

CREATE DIRECTORY exampleDir AS '/example/tutorial';

Then, we use the exampleDir directory object in the BFILENAME function as follows:

SELECT BFILENAME('exampleDir', 'tut.png')
 FROM dual;