1.3 LOB Classifications
LOBs store a variety of data such as audio, video, documents, and so on. Based on the type of data stored in the LOB or memory management mechanism used, there are different classifications.
- Large Object Data Types
Oracle Database provides a set of large object data types as SQL data types, where the term LOB generally refers to the set. - Types of LOBs
This section describes the three types of LOB data that Oracle supports. - LOBs in Object Data Types
Typically, there is no difference in the use of a LOB instance in a LOB column or in an object data type, as its member. - Oracle Data Types Stored in LOBs
Many data types provided with Oracle Database are stored as or created with LOB types.
Parent topic: Introduction to Large Objects and SecureFiles
1.3.1 Large Object Data Types
Oracle Database provides a set of large object data types as SQL data types, where the term LOB generally refers to the set.
In general, the descriptions given for the data types in this table and related sections, also apply to the corresponding data types provided for other programmatic environments.
The following table describes each large object data type that the database supports and describes the kind of data that uses it.
Table 1-1 Types of Large Object Data
SQL Data Type | Description |
---|---|
|
Binary Large Object Stores any kinds of data in binary format. Used for images, audio, and video. |
|
Character Large Object Stores string data in the database character set format. Used for large strings or documents that use the database character set exclusively. Characters in the database character set are in a fixed width format. |
|
National Character Set Large Object Stores string data in National Character Set format, typically large strings or documents. Supports characters of varying width format. |
|
External Binary File A binary file stored outside of the database in the host operating system file system, but accessible from database tables. Any kind of data, that is, any operating system file, can be stored in a |
Parent topic: LOB Classifications
1.3.2 Types of LOBs
This section describes the three types of LOB data that Oracle supports.
Persistent LOBs
A persistent LOB is a LOB instance that exists in a table row in the database. Persistent LOBs participate in database transactions. You can recover persistent LOBs in the event of transaction or media failure, and any changes to a persistent LOB value can be committed or rolled back. In other words, all the Atomicity, Consistency, Isolation, and Durability (ACID) properties that apply to database objects apply to persistent LOBs. Persistent LOBs can be of data types BLOB
, CLOB
and NCLOB
.
Temporary LOBs
A temporary LOB instance is created when you instantiate a LOB only within the scope of your local application. Temporary LOBs are transient, just like other local variables in an application. A temporary LOB becomes persistent when you insert it into a table row. Temporary LOBs can be of data types BLOB
, CLOB
and NCLOB
.
A Value LOB is a special kind of read-only temporary LOB with optimizations for better performance and manageability compared to a reference LOB. Many applications use LOBs to store medium-sized objects, about a few mega-bytes in size, and just want to read the LOB value in the context of a SQL query. Oracle recommends that you use Value LOBs for applications which use LOBs as a larger VARCHAR
or RAW
data type.
BFILEs
BFILE
s are data objects stored in operating system files, outside the database tablespaces. Data stored in a table column of type BFILE
is physically located in an operating system file, not in the database.
BFILE
s are read-only data types. The database allows read-only byte stream access to data stored in BFILE
s. You cannot write to or update a BFILE
from within your application.
You typically use BFILE
s to hold:
-
Binary data that does not change while your application is running, such as graphics
-
Data that is loaded into other large object types, such as a
BLOB
orCLOB
, where the data can then be manipulated -
Data that is appropriate for byte-stream access, such as multimedia
Any storage device accessed by your operating system can hold BFILE
data, including hard disk drives, CD-ROMs, PhotoCDs, and DVDs. The database can access BFILE
s provided the operating system supports stream-mode access to the operating system files.
Note:
All the information related to BFILEs is exclusively documented either in BFILEs or in Managing LOBs: Database Administration.The following picture summarizes the relationship between different kinds of LOBs.
Parent topic: LOB Classifications
1.3.3 LOBs in Object Data Types
Typically, there is no difference in the use of a LOB instance in a LOB column or in an object data type, as its member.
In this guide, the term LOB attribute refers to a LOB instance that is a member of an object data type. Unless otherwise specified, discussions that apply to LOB columns also apply to LOB attributes.
Parent topic: LOB Classifications
1.3.4 Oracle Data Types Stored in LOBs
Many data types provided with Oracle Database are stored as or created with LOB types.
The following list mentions a few data types that you can store with LOB types:
VARCHAR2
orRAW
data types of size greater than 4000 bytesJSON
data typeXMLType
stored asBINARY XML
orCLOB
VARRAY
stored as LOB
Parent topic: LOB Classifications