Large objects
A large object (LOB) is a string data type with a size ranging from 0 bytes to 2 GB (GB equals 1 073 741 824 bytes).
The VARCHAR, VARGRAPHIC, and VARBINARY data types have a limit of 32 KB (where KB equals 1024 bytes) of storage. While this might be sufficient for small to medium-sized text data, applications often need to store large text documents. They might also need to store a wide variety of additional data types, such as audio, video, drawings, mixed text and graphics, and images. Some data types can store these data objects as strings of up to 2 GB.
These data types are binary large objects (BLOBs), single-byte character large objects (CLOBs), and double-byte character large objects (DBCLOBs). Each table can have a large amount of associated LOB data. Although a single row that contains one or more LOB values cannot exceed 3.5 GB, a table can contain nearly 256 GB of LOB data.
You can refer to and manipulate LOBs using host variables as you do any other data type. However, host variables use the program's storage that might not be large enough to hold LOB values, so you might need to manipulate large values in other ways. Locators are useful for identifying and manipulating a large object value at the database server and for extracting pieces of the LOB value. File reference variables are useful for physically moving a large object value (or a large part of it) to and from the client.
- Large object data types
Here are the definitions of binary large objects (BLOBs), character large objects (CLOBs), and double-byte character large objects (DBCLOBs).
- Large object locators
A large object (LOB) locator is a small, easily managed value that is used to refer to a much larger value.
- Example: Using a locator to work with a CLOB value
Suppose that you want your application program to retrieve a locator for a large object (LOB) value and then use the locator to extract data from the LOB value.
- Indicator variables and LOB locators
For normal host variables in an application program, when selecting a NULL value into a host variable, a negative value is assigned to the indicator variable signifying that the value is NULL. In the case of LOB locators, however, the meaning of indicator variables is slightly different.
- LOB file reference variables
File reference variables are similar to host variables except that they are used to transfer data to and from integrated file system files (not to and from memory buffers).
- Example: Extracting CLOB data to a file
Suppose that retrieve character large object (CLOB) elements from a table into an external file.
- Example: Inserting data into a CLOB column
This example shows how to insert data from a regular file referenced by :hv_text_file into a character large object (CLOB) column.
- Displaying the layout of LOB columns
When you use CL commands, such as Display Physical File Member (DSPPFM), to display a row of data from a table that holds large object (LOB) columns, the LOB data stored in the row is not displayed. Instead, the database shows a special value for the LOB columns.
- Journal entry layout of LOB columns
These commands return a buffer that gives the user addressability to the large object (LOB) data that has been journaled.
Parent topic:
Processing special data types