Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

CHAPTER 12: Using LOBs and BFILEs > External LOBs (BFILEs) in SQL and PL/SQL

External LOBs (BFILEs) in SQL and PL/SQL

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.

ImageNote 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.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial