OceanBase logo

OceanBase

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

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

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

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 Database

SQL - V4.3.1

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & Certification
    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 Database
    3. SQL
    4. V4.3.1
    iconOceanBase Database
    SQL - V 4.3.1
    SQL
    KV
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    About error codes

    Last Updated:2026-04-15 08:25:14  Updated
    share
    What is on this page
    SQLSTATE
    Error codes
    Error messages

    folded

    share

    This topic describes the composition and meaning of error codes in OceanBase Database.

    Whether you use a Java or C driver to connect to OceanBase Database, when any SQL statement fails to execute, you will receive an error indicating the failure. An error usually consists of the following three parts:

    • A 32-bit integer error code

    • A 5-character SQLSTATE value

    • A human-readable error message

    For example, if an SQL statement failed to be executed after you connect to OceanBase Database through OceanBase Client (OBClient), the system displays the following error message on the command-line interface (CLI) of OBClient:

    ERROR 1054 (42S22): Unknown column 'haha' in 'field list'
    

    Here, 1054 is the error code, 42S22 in the parentheses is the SQLSTATE value, and the colon is followed by the error message.

    For compatibility, different error codes may be returned for the same error in MySQL mode (the sys tenant is in MySQL mode) and Oracle mode. For example, the internal error code -5217 of OceanBase Database indicates that a column name referenced in an SQL statement does not exist. The following table describes the error codes returned for this error in two tenant modes.

    Tenant mode Error code SQLSTATE Error message
    MySQL 1054 42S22 Unknown column
    Oracle 904, namely, ORA-00904 42S22 invalid identifier

    You can use the error code parsing tool ob_error 10 to query the meaning of error codes and the mappings between internal and external error codes. For more information about the ob_error tool, see ob_error.

    SQLSTATE

    SQLSTATE is an error code specified by the SQL standard. It is a string that contains five characters that can be digits or uppercase Latin letters. The first two characters indicate the error category, and the last three characters indicate the specific error. For example, 00 indicates success, 01 indicates a warning, 02 indicates that data is not found, 22 indicates a data error, and 42 indicates a syntax error. Therefore, for the same error, OceanBase Database returns the same SQLSTATE value in MySQL mode and Oracle mode.

    Theoretically, all databases that conform to the SQL standard return the same SQLSTATE value for the same error, so that the error handling logic of applications can be compatible with different databases.

    Error codes

    Although the SQL standard specifies SQLSTATE, the development of the standard always lags behind the practice of database manufacturers. Manufacturers usually need to define their own error codes (vendor codes) to identify more detailed error causes. In addition, error codes defined by a manufacturer are not compatible with databases provided by other manufacturers.

    In OceanBase Database, the SQLSTATE value is generally HY000 for custom error codes that are incompatible with other databases.

    Error messages

    Error messages are user-friendly prompt information. However, the messages may change as the database version evolves, and different messages may be displayed for the same error due to the language settings. Therefore, errors in applications are usually handled based on error codes or SQLSTATE instead of error messages.

    Previous topic

    Roll back a transaction
    Last

    Next topic

    Error handling specifications for MySQL-compatible applications
    Next
    What is on this page
    SQLSTATE
    Error codes
    Error messages