This article is written about how to use the Oracle/PLSQL BFILENAME function with syntax and examples.
Description
The Oracle/PLSQL BFILENAME function returns a BFILE locator for a physical LOB binary file.
Syntax
The syntax for the BFILENAME function in Oracle/PLSQL is:
BFILENAME( 'directory', 'filename' )
Parameters or Arguments
directory
A directory object that serves as an alias for the full path to where the file is located on the file server.
filename
The name of the file on the file server.
Returns
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
Example
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;
Leave a Review