Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

How do I access Oracle B Files

by Rifraf (Novice)
on Dec 06, 2001 at 02:31 UTC ( #129779=categorized question: print w/replies, xml ) Need Help??
Contributed by Rifraf on Dec 06, 2001 at 02:31 UTC
Q&A  > database programming


How do I select an object of type BINARY FILE LOB in an Oracle database. The column in the table is a locator that points to a flat file, it is called a B File.

Answer: How do I access Oracle B Files
contributed by Snuggle

This question is pretty vauge, but here it goes...
In ORACLE, binary files are housed in a couple of different formats. LOB, BLOB, CLOB are all pretty much the same in that they hold the binary information in the database itself. BFiles are basically, as you said, pointers to files on the OS. I assume your question is that you want to populate a table with some BFiles, and not that you want to get the files actually on the database itself (BLOB).
Use of the function
BFILENAME(<directory handle>, '<filename>')
will return a handle to the bfile that you can then INSERT into the table. One thing about the <directory handle> parameter...
In your init.ora file in your Oracle Home you need to include the line

UTL_FILE_DIR = <path>

You then need to have give the directory a handle by using the following SQL:
CREATE OR REPLACE DIRECTORY <directory handle> AS '<path>'
You can check that the directory handle was made by:
SELECT * FROM sys.user_directories
It is this directory handle that you have to send to BFILENAME to tload the file pointer into the Database.

Please (register and) log in if you wish to add an answer

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (6)
    As of 2018-12-15 11:31 GMT
    Find Nodes?
      Voting Booth?
      How many stories does it take before you've heard them all?

      Results (69 votes). Check out past polls.