LOB Data type in DB2.

We have various different type of data types in DB2.  For ex- SMALL INT,INT,CHAR,VARCHAR..

These data types seems to work fine and do their job perfectly .But if you want to store large audio,video, images or any other file which has much larger size than 32kb they cant handle it.

VARCHAR ,VARGRAPHIC,VARBINARY has the storage limit of 32 KB.

For data objects that are larger than 32 KB, you have to use something called as large object (LOB) data types to store these objects.

DB2 provides three different type of LOB data types to store these data objects as strings of up to 2 GB in size:
Character large objects (CLOBs) :
 
Use this data type if your data is larger (or might grow larger) than the VARCHAR data type permits. It can store up to 2GB. For example, you can store information such as an employee resume, or the text of book in a CLOB.
 
Double-byte character large objects (DBCLOBs)
 
Use the DBCLOB data type to store large amounts of DBCS data, such as documents that use a DBCS character set.
 
Binary large objects (BLOBs)
 
Use the BLOB data type to store large amounts of non character data, such as pictures, voice, and mixed media.
If your data does not fit entirely within a data page, you can define one or more columns as LOB columns.

Example :

CREATE TABLE EMPLOYEE_SALARY
     (DEPTNO   CHAR(3)      NOT NULL, EMP_RESUME  BLOB(1G) )


 

1 comment:

Post a Comment