Press "Enter" to skip to content

Bfilename in Oracle Example

In Oracle, BFILENAME Function returns a BFILE locator that is linked with a physical LOB file on the server file system. Below is an example to store a file into a table using BFILENAME in Oracle.


BFILENAME function takes two arguments, first is the directory object name and second is the file name.

BFILENAME (directory_object, file_name)

BFILENAME Function Example

In the following example, we will create a table emp_resume and a directory object to store resume file using the BFILE data type and then will insert a record using BFILENAME function.

    1. Create a Table and a Directory Object
    Create Table emp_resume (Empno NUMBER, resume BFILE)
    Create or Replace Directory MY_DOC as 'C:\Docs'
    1. Insert a record into the table using BFILENAME function
    INSERT INTO emp_resume (empno, resume) 
    VALUES (7399, BFILENAME ('MY_DOC', '7369_Resume.doc'));


1 row created.

See also:

Vinish Kapoor

I am a full stack developer and writing about development. I document everything I learn and help thousands of people. is created, written, and maintained by me, it is built on WordPress, and hosted by Bluehost. Connect with me on Facebook, Twitter, GitHub and get notifications for new posts.

You may also like:

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *