OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Call Interface

V2.0.2Enterprise Edition

  • What's New
  • Product Introduction
  • Install OBCI
  • Data types
  • Reference Functions
    • Connect, authorize, and initialize functions
    • Handle and descriptor functions
    • Bind, define, and describe functions
    • Statement functions
    • LOB functions
    • Transaction functions
    • Miscellaneous functions
    • String functions
    • Date and Datetime functions
    • Interval functions
    • Number functions
    • Terminate functions
  • Developer Guide
    • Basic development procedure
    • Development example

Download PDF

What's New Product Introduction Install OBCI Data types Connect, authorize, and initialize functions Handle and descriptor functions Bind, define, and describe functions Statement functions LOB functions Transaction functions Miscellaneous functions String functions Date and Datetime functions Interval functions Number functions Terminate functions Basic development procedure Development example
OceanBase logo

The Unified Distributed Database for the AI Era.

Follow Us
Products
OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
Resources
DocsBlogWhite PaperLive DemosTraining & CertificationTicket
Company
About OceanBaseTrust CenterLegalPartnerContact Us
Follow Us

© OceanBase 2026. All rights reserved

Cloud Service AgreementPrivacy PolicySecurity
Contact Us
Document Feedback
  1. Documentation Center
  2. OceanBase Call Interface
  3. V2.0.2
iconOceanBase Call Interface
V 2.0.2Enterprise Edition
Databases
  • OceanBase Database
  • OceanBase Cloud
  • OceanBase Tugraph
  • Interactive Tutorials
  • OceanBase Best Practices
Tools
  • OceanBase Cloud Platform
  • OceanBase Migration Service
  • OceanBase Developer Center
  • OceanBase Migration Assessment
  • OceanBase Admin Tool
  • OceanBase Loader and Dumper
  • OceanBase Deployer
  • Kubernetes operator for OceanBase
  • OceanBase Diagnostic Tool
  • OceanBase Binlog Service
Connectors and Middleware
  • OceanBase Database Proxy
  • Embedded SQL in C for OceanBase
  • OceanBase Call Interface
  • OceanBase Connector/C
  • OceanBase Connector/J
  • OceanBase Connector/ODBC
  • OceanBase Connector/NET

LOB functions

Last Updated:2023-06-29 06:42:03  Updated
Share
What is on this page
OCILobGetLength
OCILobRead
OCILobRead2()
OCILobWrite
OCILobLocatorIsInit
OCILobOpen
OCILobClose
OCILobIsOpen
OCILobTrim
OCILobTrim2

folded

Share

#docslug#/obci/obci/V2.0.2/wbz81w

OCILobGetLength

Purpose : You can call this function to return the length of a large object (LOB) in bytes.

Function syntax :

sword OCILobGetLength ( 
OCISvcCtx *svchp,
OCIError *errhp,
OCILobLocator *locp,
ub4 *lenp );

Parameters :

Parameter
Description
svchp(IN) A pointer to a context handle.
errhp(IN/OUT) An error handle.
locp(IN) A pointer to an LOB locator.
lenp(OUT) The returned length of the LOB, in bytes.

Return value : OCI_SUCCESS is returned if the function call succeeded, or OCI_ERROR is returned if the function call failed.

OCILobRead

Purpose : You can call this function to read the content of a specified length from an LOB.

Function syntax :

sword OCILobRead ( 
    OCISvcCtx *svchp,
    OCIError *errhp,
    OCILobLocator *locp,
    ub4 *amtp,
    ub4 offset,
    dvoid *bufp,
    ub4 bufl,
    dvoid *ctxp,
    OCICallbackLobRead (cbfp)
                        ( dvoid *ctxp,
                        CONST dvoid *bufp,
                        ub4 len,
                        ub1 piece
                        )
    ub2 csid,
    ub1 csfrm );

Parameters :

Parameter
Description
svchp(IN) A pointer to a context handle.
errhp(IN/OUT) An error handle.
locp(IN) A pointer to an LOB locator.
Amtp(IN/OUT) The amount of input or output bytes. When the function is called, this parameter indicates the number of bytes to be read. After the function is executed, OBCI backfills the number of bytes that were actually read.
offset A reserved parameter.
bufp(IN) The pointer to the buffer that stores the data read.
bufl(IN) The length of the buffer that stores the data read.
ctxp The context pointer of the callback function. The value can be NULL.
cbfp A callback function that can be registered as a function that can be called by each piece.
csid The character set ID of the buffer data.
csfrm The character set form of the buffer data.

Return value : OCI_NEED_DATA is returned if the function call succeeded but the data reading has not completed. OCI_SUCCESS is returned after the data reading is completed OCI_ERROR is returned if the function call failed.

OCILobRead2()

Purpose : You can call this function to read the content of a specified length from an LOB. This function must be used for LOBs greater than 4 GB. You can choose to use the OCILobRead2() or OCILobRead() function for LOBs smaller than 4 GB. Note

This function is available only in OceanBase Database V2.2.76 and later versions.

Function syntax :

sword OCILobRead2 ( 
                    OCISvcCtx          *svchp,
                    OCIError           *errhp,
                    OCILobLocator      *locp,
                    oraub8             *byte_amtp,
                    oraub8             *char_amtp,
                    oraub8             offset,
                    void               *bufp,
                    oraub8             bufl,
                    ub1                piece,
                    void               *ctxp, 
                    OCICallbackLobRead2 (cbfp)
                                        ( void          *ctxp,
                                          const void    *bufp,
                                          oraub8        lenp,
                                          ub1           piecep
                                          void          **changed_bufpp,
                                          oraub8        *changed_lenp
                                        )
                    ub2                csid,
                    ub1                csfrm );

Parameters :

Parameter
Description
svchp(IN) A pointer to a context handle.
errhp(IN/OUT) An error handle.
locp(IN) A pointer to an LOB locator.
byte_amtp (IN/OUT) The parameter indicates the number of bytes to read from the database when the value is IN. This parameter is always used for a field whose data type is BLOB or BFILE. For a field whose data type is CLOB or NCLOB, it is used only when char_amtp is 0. The parameter indicates the number of bytes read into the user buffer when the value is OUT.
char_amtp (IN/OUT) The parameter indicates the maximum number of characters read into the user buffer when the value is IN. The parameter indicates the number of characters read into the user buffer when the value is OUT.
offset A reserved parameter.
bufp(IN) The pointer to the buffer that stores the data read.
bufl(IN) The length of the buffer that stores the data read.
piece (IN) A reserved parameter.
ctxp The context pointer of the callback function. The value can be NULL.
bufp (IN/OUT) A buffer pointer to a piece.
lenp (IN) The length in bytes of the current piece in bufp.
piecep (IN) Indicates whether the piece type is OCI_FIRST_PIECE, OCI_NEXT_PIECE, or OCI_LAST_PIECE.
changed_bufpp (OUT) The address of a new buffer. The default old buffer, that is, the buffer that the bufp parameter points to, is used if this parameter is set to NULL.
changed_lenp (OUT) The length of the new buffer.
cbfp A callback function that can be registered as a function that can be called by each piece.
csid The character set ID of the buffer data.
csfrm The character set form of the buffer data.

Return value : OCI_NEED_DATA is returned if the function call succeeded but the data reading has not completed. OCI_SUCCESS is returned after the data reading is completed OCI_ERROR is returned if the function call failed.

OCILobWrite

Purpose : You can call this function to continuously write content into an LOB.

Function syntax :

sword OCILobWrite ( 
    OCISvcCtx *svchp,
    OCIError *errhp,
    OCILobLocator *locp,
    ub4 *amtp,
    ub4 offset,
    void *bufp,
    ub4 buflen,
    ub1 piece,
    void *ctxp,
    OCICallbackLobWrite (cbfp) 
                   (
                    void *ctxp,
                    void *bufp,
                    ub4 *lenp,
                    ub1 *piecep
                    )
    ub2 csid,
    ub1 csfrm );

Parameters :

Parameter
Description
svchp(IN) A pointer to a context handle.
errhp(IN/OUT) An error handle.
locp(IN) A pointer to an LOB locator.
amtp(IN/OUT) The amount of input or output bytes. When the function is called, this parameter indicates the number of bytes to be read. After the function is executed, OBCI backfills the number of bytes that were actually read.
offset A reserved parameter.
bufp(IN) The pointer to the buffer that stores the data read.
buflen(IN) The length of the buffer that stores the data read.
piece A reserved parameter.
ctxp A reserved parameter.
cbfp A reserved parameter.
csid A reserved parameter.
csfrm A reserved parameter.

Return value : OCI_SUCCESS is returned if the function call succeeded, or OCI_ERROR is returned if the function call failed.

OCILobLocatorIsInit

Purpose : You can call this function to verify whether the given LOB or BFILE locator has been initialized.

Function syntax :

sword OCILobLocatorIsInit ( 
OCIEnv *envhp,
OCIError *errhp,
const OCILobLocator *locp,
boolean *is_initialized );

Parameters :

Parameter
Description
svchp(IN/OUT) A pointer to a context handle.
errhp(IN/OUT) An error handle.
locp(IN) An LOB or BFILE locator.
is_initialized (OUT) Returns TRUE if the given LOB or BFILE locator has been initialized, and FALSE if otherwise.

Return value : OCI_SUCCESS is returned if the function call succeeded, or OCI_ERROR is returned if the function call failed.

OCILobOpen

Purpose : You can call this function to open an LOB or BFILE object.

Function syntax :

sword OCILobOpen ( 
OCISvcCtx *svchp,
OCIError *errhp,
OCILobLocator *locp,
ub1 mode );

Parameters :

Parameter
Description
svchp(IN) A pointer to a context handle.
errhp(IN/OUT) An error handle.
locp(IN/OUT) An LOB or BFILE locator.
mode (IN) The opening mode.

Return value : OCI_SUCCESS is returned if the function call succeeded, or OCI_ERROR is returned if the function call failed.

OCILobClose

Purpose : You can call this function to close an LOB or BFILE object.

Function syntax :

sword OCILobClose ( 
OCISvcCtx *svchp,
OCIError *errhp,
OCILobLocator *locp );

Parameters :

Parameter
Description
svchp(IN) A pointer to a context handle.
errhp(IN/OUT) An error handle.
locp(IN/OUT) An LOB or BFILE locator.

Return value : OCI_SUCCESS is returned if the function call succeeded, or OCI_ERROR is returned if the function call failed.

OCILobIsOpen

Purpose : You can call this function to test whether an LOB or FILE object is open.

Function syntax :

sword OCILobIsOpen ( 
OCISvcCtx        *svchp,
OCIError         *errhp,
OCILobLocator    *locp,
boolean          *flag );

Parameters :

Parameter
Description
svchp(IN) A pointer to a context handle.
errhp(IN/OUT) An error handle.
locp(IN) An LOB or FILE locator.
flag(OUT) Returns TRUE if the LOB or FILE object is open, or FALSE if otherwise.

Return value : OCI_SUCCESS is returned if the function call succeeded, or OCI_ERROR is returned if the function call failed.

OCILobTrim

Purpose : You can call this function to trim an LOB value to a shorter length.

Function syntax :

sword OCILobTrim ( 
OCISvcCtx       *svchp,
OCIError        *errhp,
OCILobLocator   *locp,
ub4             newlen );

Parameters :

Parameter
Description
svchp(IN) A pointer to a context handle.
errhp(IN/OUT) An error handle.
locp(IN) An LOB or FILE locator.
newlen(IN) The new length of the LOB value, which must be shorter than or equal to the current length. For character LOBs, it indicates the number of characters, and for binary LOBs and BFILEs, it indicates the number of bytes in the LOB.

Return value : OCI_SUCCESS is returned if the function call succeeded, or OCI_ERROR is returned if the function call failed.

OCILobTrim2

Purpose : You can call this function to trim an LOB value to a shorter length. This function must be used for LOBs greater than 4 GB. You can also use this function for LOBs smaller than 4 GB.

Function syntax :

sword OCILobTrim2 ( 
OCISvcCtx       *svchp,
OCIError        *errhp,
OCILobLocator   *locp,
ub4             newlen );

Parameters :

Parameter
Description
svchp(IN) A pointer to a context handle.
errhp(IN/OUT) An error handle.
locp(IN) An LOB or FILE locator.
newlen(IN) The new length of the LOB value, which must be shorter than or equal to the current length. For character LOBs, it indicates the number of characters, and for binary LOBs and BFILEs, it indicates the number of bytes in the LOB.

Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_ERROR is returned if the function call failed.

Previous topic

Statement functions
Last

Next topic

Transaction functions
Next
What is on this page
OCILobGetLength
OCILobRead
OCILobRead2()
OCILobWrite
OCILobLocatorIsInit
OCILobOpen
OCILobClose
OCILobIsOpen
OCILobTrim
OCILobTrim2