Upload
ptkguly3871
View
7
Download
0
Embed Size (px)
DESCRIPTION
PL SQL LOB datatype
Citation preview
6/1/2015 SkillSoft Learning Object
https://library.skillport.com/courseware/cbtlib/216518/216963/eng/article/lp1/pages/nito.html? 1/2
| Print | Contents |
Composite and LOB data types
Abstract
This article discusses the function of composite data types and large object (LOB) datatypes in Oracle 10g. It focuses on the kinds of composite data types as well as thedifferent types of LOB, such as the binary large object (BLOB) data type.
Abstract
A composite data type has internal components that can be individually manipulated. Sothe composite data type is distinguished from a scalar type, which can only store a singlevalue and has no internal components.
Records and collections
In PL/SQL the two main kinds of composite data types are records and collections. Arecord, as represented by the RECORD type, is similar to a row in a database table. It iscomposed of one or more fields, which have a logical relation to each other, but each fielddoes not necessarily have the same data type. You use a record to store the same kind ofinformation as a row in a database, so a record could, for example, hold the details of aspecific kind of product produced by a company. The individual fields the product name,the product id, and the cost price are not of the same data type but are related to theproduct they describe.
A collection can be regarded as the PL/SQL equivalent of an array. That is, collections asrepresented by the TABLE, NESTED TABLE, and VARRAY types are used to treat groupsof data, having the same data type, as a single unit. A typical collection may contain all theproduct names for a specific company, or a list of prices for these products. The threecollection data types have different methods of referring to individual components in thecollection. For example, a VARRAY uses a series of integers, starting from one, to refer toeach element in it.
Large objects and LOB data type variables
Large objects (LOBs) are data type variables that are designed to store large amounts ofdata. A database column can be of the LOB category and the corresponding LOB datatype variables are defined. With these data types, you can store blocks of unstructured datasuch as text, graphic images, video clips, and sound wave forms up to 4 GB in size. LOBdata types allow efficient, random, piecewise access to the data and can be attributes of anobject type. There are four kinds of LOB data types defined for variables character largeobject (CLOB), binary large object (BLOB), binary file (BFILE), and national languagecharacter large object (NCLOB). Variables with these data types use locators or pointers tothe actual data. The data for BLOB, CLOB, and NCLOB types is stored in the database, inor outside the row. However, BFILE data is stored outside the database.
The CLOB data type
6/1/2015 SkillSoft Learning Object
https://library.skillport.com/courseware/cbtlib/216518/216963/eng/article/lp1/pages/nito.html? 2/2
The character large object (CLOB) data type is used to store large blocks of singlebytecharacter data in the database. For example, you can use this data type to store largeamounts of text, such as a detailed report or a book, stored in a single byte format.
The BLOB data type
The binary large object (BLOB) data type is used to store large unstructured or structuredbinary objects in the database. When you insert or retrieve such data to and from thedatabase, the database does not interpret the data. So BLOB data is created andmanipulated by external applications that use that data. A BLOB data type might be usedto store highresolution digital images taken from a digital camera. These images cannotbe interpreted by the database, but may be edited by an external package such asPhotoshop.
The BFILE data type
The binary file (BFILE) data type is used to store large binary files. Unlike other LOBs,BFILES are stored outside the database, only the locator is stored in the database. Assuch, BFILES are read only. A typical BFILE might point to the location of a movie filestored in some suitable format (MPEG or AVI).
The NCLOB data type
The national language character large object (NCLOB) data type is used to store largeblocks of singlebyte or fixedwidth multibyte NCHAR Unicode data in the database. Thisdata type does not support variablewidth character sets, and may be used in thosesituations where the CLOB data type is inappropriate, such as a book written in a languagethat cannot be rendered using a singlebyte character set.