Home > Ask the Oracle Experts > Questions & Answers
Ask The Oracle Expert: Questions & Answers
EMAIL THIS

Updating a BLOB column without BFILE/create directory options

Brian Peasland EXPERT RESPONSE FROM: Brian Peasland

Pose a Question
Other Oracle Categories
Meet all Oracle Experts
Become an Expert for this site
>
QUESTION POSED ON: 31 July 2002
Howcan you update a BLOB column within a table and not use the bfile/create directory options?

>
EXPERT RESPONSE

In order to answer this question, I think it might be best to clarify some terminology. Oracle introduced Large Objects (LOBs) back in Oracle 8. The collection of LOB datatypes are meant to replace the LONG and LONG RAW datatypes available in earlier Oracle versions.

For storing large character data, Oracle has the Character LOB, or CLOB. This replaces the LONG datatype. For storing binary large objects directly in the database, use the Binary LOB datatype, or BLOB. This replaces the LONG RAW datatype.

Additionally, one can reference binary objects from the table, but the object does not even exist in the database. This is done with the BFILE datatype. The BFILE datatype is nothing more than a pointer to a Binary File located on your database server's filesystem.

Hopefully, you can see that there is a difference between a "BLOB" and a "BFILE". A BLOB is stored internally, and a BFILE is stored externally. A BLOB gets the benefits of any internal datatype. A BFILE must be managed by the OS. The OS is responsible for the security of the object, backing up the object, and handling the object. The database does all of this for the BLOB.

Since a BFILE is stored externally, the database can only read the binary object. It cannot write to the BFILE. The only way to modify the BFILE object is to use external programs, utilities, or OS commands to modify the contents of the file itself. For many applications, the easiest way to accomplish this is to just erase the file and put a new file in it's place. The database does not need to be updated since it just has a pointer to the BFILE.

Oracle has supplied a PL/SQL package, DBMS_LOB, to manipulate CLOBs and BLOBs right from your PL/SQL routines, i.e. packages, procedures, triggers, functions. If you do not like using the DBMS_LOB package for your LOB manipulation, then many application interfaces support LOB manipulation. For instance, if you are coding in Java, then the JDBC libraries contain functions for LOB manipulation. Other application programming interfaces have similar routines and you may want to check them out!

For More Information


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

HomeNewsTopicsTipsAsk the ExpertsMultimediaWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2003 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts