A LOB instance has a locator and a value. A LOB locator is a reference, or a pointer, to where the LOB value is physically stored. The LOB value is the data stored in the LOB.
A LOB locator can be assigned to any LOB instance of the same type, such as
BFILE. When you use a LOB in an operation such as passing a LOB as a parameter, you are actually passing a LOB locator. For the most part, you can work with a LOB instance in your application without being concerned with the semantics of LOB locators. There is no requirement to dereference LOB locators, as is required with pointers in some programming languages.
There are two different techniques to access and modify LOBs:
1.5.1 Using LOBs Without Locators
LOBs can be used in many operations similar to how VARCHAR2 or RAW data types are used. Such LOB operations can be performed without the use of LOB locators.
- SQL and PLSQL built-in functions and implicit assignments
- Data interface on LOBs that enables you to insert or select
entire LOB data in a LOB column without using a LOB locator as follows:
- Use a bind variable associated with a LOB column to
insert character data into a
RAWdata into a
BLOB. For example, in PLSQL you can insert a
VARCHAR2buffer into a
CLOBcolumn, and in OCI you can bind a buffer of type
- Define an output buffer in your application that holds
character data selected from a
RAWdata selected from a
BLOB. For example, in PLSQL you can select the
CLOBoutput of a query into a
VARCHAR2buffer, and in OCI you can define a
CLOBquery result item to a buffer of type
See Also:Data Interface for LOBs
- Use a bind variable associated with a LOB column to insert character data into a
1.5.2 Using LOBs with Locators
You can use the LOB locator to access and modify LOB values by passing the LOB locator to the LOB APIs supplied with the database. These operations support efficient piecewise read and write to LOBs.
You should use this mode if your application needs to perform random or piecewise read or write calls to LOBs, which means it needs to specify the offset or amount of the operation to read or write a part of the LOB value.
See Also:Locator Interface for LOBs