Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
External LOBs, or BFILEs, contain a locator to a binary file that typically resides in the operating system. Let’s quickly go through how to use BFILEs in SQL and/or PL/SQL first.
In the following example, the BFILE entry points to a text file called bfile_test.txt in the directory C:\TEMP, which contains the following four lines:
This is a test.
This is line number 2.
This is line number 3.
This is the final line.
To use a BFILE in SQL, we first need to create a directory object in SQL as follows:
benchmark@ORA10G> create or replace directory my_dir as 'C:\TEMP';
Directory created.
Note A
directory is a database object that serves as an alias for a full path name on the server’s file system where the files are actually located. Note that you need to ensure that the directory you give as the argument is valid on your database server. In other words, the directory should be visible to your database server.