Oracle / PLSQL: BFILENAME Function

This article is written about how to use the Oracle/PLSQL BFILENAME function with syntax and examples.


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


The syntax for the BFILENAME function in Oracle/PLSQL is:

BFILENAME( 'directory', 'filename' )

Parameters or Arguments


A directory object that serves as an alias for the full path to where the file is located on the file server.


The name of the file on the file server.


The BFILENAME function returns a BFILE locator.

Applies To

The BFILENAME function can be used in the following versions of Oracle/PLSQL:

Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i


Let’s look at some Oracle BFILENAME function examples and explore how to use the BFILENAME function in Oracle/PLSQL.

For example:

First, we need to create a directory object called exampleDir that points to /example/totn on the file server.

CREATE DIRECTORY exampleDir AS '/example/totn';

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

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