||Oracle Tips by Burleson
Oracle 10g BFILE Datatypes
The BFILE datatype is unique, in that it has two
pieces of information stored in it: the directory object for the
file and the name of the file within that directory object.
The method of unloading BFILE columns using
the oracle_datapump access driver consists of storing the directory
object name and the file name in two separate columns in the
external table. You use the procedure dbms_lob.filegetname to return
both parts of the name.
However, because dbms_lob.filegetname is a
procedure, it cannot be used directly in a SELECT statement.
Instead, you need to create two functions. The first returns the
name of the directory object and the second returns the name of the
The steps in the following example demonstrate
the unloading of BFILE datatypes.
First you must create a function to extract
the directory object for a BFILE column. Note that when the
column is NULL, then NULL is returned.
CREATE FUNCTION get_dir_name (bf BFILE) RETURN VARCHAR2 IS
5 IF bf is
DBMS_LOB.FILEGETNAME (bf, dir_alias, file_name);
11 END IF;
Next create a function to extract the
file name for the BFILE column.
CREATE FUNCTION get_file_name (bf BFILE) RETURN VARCHAR2 is
5 IF bf is
Get the complete story:
To get the code instantly, click here:
Need an Oracle Mentor?
BEI is now offering personal mentors for Oracle DBAs where you can have an
Oracle expert right at your fingertips, anytime day or night. We work with
hundreds of Oracle databases every year, so we know exactly how to quickly
assist you with any Oracle question.
Why risk an unplanned outage? You can now get telephone access to Don
Burleson or any of his Oracle Certified DBAs with more than 20 years of
full-time IT experience. Click here for details: