8.7 Pro*C/C++ and Pro*COBOL API for LOBs

This section describes the mapping of Pro*C/C++ and Pro*COBOL locators to locator pointers to access a LOB value.

Embedded SQL statements enable you to access data stored in BLOBs, CLOBs, and NCLOBs.

See Also:

Pro*C/C++ Programmer's Guide and Pro*COBOL Programmer's Guide for detailed documentation, including syntax, host variables, host variable types and example code.

Unlike locators in PL/SQL, locators in Pro*C/C++ and Pro*COBOL are mapped to locator pointers which are then used to refer to the LOB value. To successfully complete an embedded SQL LOB statement you must do the following:

  1. Provide an allocated input locator pointer that represents a LOB that exists in the database tablespaces or external file system before you run the statement.
  2. SELECT a LOB locator into a LOB locator pointer variable.
  3. Use this variable in the embedded SQL LOB statement to access and manipulate the LOB value.

Table 8-9 Pro*C/C++ and Pro*COBOL Embedded SQL Statements for LOBs

Category Function/Procedure Description
Open/Close OPEN Open a LOB
DESCRIBE[ISOPEN] Check is a LOB is open
CLOSE Close the LOB
Read Operations DESCRIBE[LENGTH] Get the length of the LOB
DESCRIBE[CHUNKSIZE] Get the optimum read or write size
READ Read data from the LOB starting at a specified offset
Modify Operations WRITE Write data to the LOB at a specified offset
WRITE APPEND Write data to the end of the LOB
ERASE Erase part of a LOB, starting at a specified offset
TRIM Trim the LOB value to the specified shorter length
Operations involving multiple locators APPEND Append a LOB value to another LOB
COPY Copy all or part of a LOB to another LOB
ASSIGN Assign one LOB to another
LOAD FROM FILE Load BFILE data into a LOB