7.2. Large Objects (LOBs)

SQLJ supports three large object types, each of which stores a particular type of data. When you write an application, you need to choose the particular LOB type suited to the type of data you are manipulating. The three LOB types are as follows:


The Character LOB type, used to store single-byte character data.


The Binary LOB type, used to store binary data.


The Binary file type, used to store pointers to files located outside the database. You can read the contents of such a file as a stream of bytes via a BFILE pointer. The external files can be on a hard disk, CD-ROM, DVD-ROM, or other device.

Prior to Oracle8, your only choice for storing large amounts of character or binary data was to use the LONG and LONG RAW types. The newer CLOB and BLOB types have three advantages over the LONG and LONG RAW types:

  • LOBs can store up to 4GB of data, double the 2GB capacity of LONG and LONG RAW columns.

  • LOB contents can be accessed randomly, whereas LONG and LONG RAW contents can only be accessed sequentially.

  • A table can contain multiple LOB columns, but only one LONG or LONG RAW column.

LOBs are composed of two parts:


A LOB's locator is a pointer that specifies the location of the LOB content.


Content refers to the actual characters, or bytes, that are stored in the LOB. If the content is less than 4KB in size, it is stored in the table containing the LOB column; otherwise, it is stored outside the table. ...

Get Java Programming with Oracle SQLJ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.