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.5

    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.5
    iconOceanBase Database
    SQL - V 4.3.5
    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

    COERCIBILITY

    Last Updated:2026-04-09 02:53:55  Updated
    share
    What is on this page
    Syntax
    Purpose
    Examples

    folded

    share

    Syntax

    COERCIBILITY(str)
    

    Purpose

    COERCIBILITY() returns the collation coercibility value of the str argument for multilingual linguistic sorting.

    Two variables of the same character set are compared based on their collations. However, when two variables of different character sets are compared, the precedence of their collations must be determined. Take the following statement as an example:

    obclient> SELECT c1 FROM t WHERE c1 = 'Y';
    

    If the column c1 and the string literal 'Y' use the same collation, no ambiguity exists. If a different collation is specified for the t table in table_option or a different collation is specified for the system parameter collation_connection, the collation used in the comparison depends on the precedence of the two collations.

    The following table describes the precedence of different collations. A smaller value indicates higher precedence.

    Value Description Example
    0 Explicit collation An explicit COLLATE clause
    1 No collation The concatenation of strings with different collations
    2 Implicit collation A column value, system parameter, or variable
    3 System constant A return value of a system function such as USER()
    4 Coercible A literal string
    5 Numeric A numeric or temporal value
    6 Ignorable NULL or an expression whose result is NULL

    OceanBase Database uses coercibility values and the following rules to eliminate ambiguities:

    • A smaller coercibility value has higher precedence.

    • If the collations of the two compared items have the same coercibility value, the following supplementary rules are used:

      • If both or none of the two character sets are Unicode, and different collations are used, an error is returned.

      • The item that uses a Unicode character set has higher precedence over the one that does not. For example, the following statement does not return an error:

          obclient> SELECT CONCAT(t1.utf8_column, t2.gbk_column) FROM t1,t2;
        
      • If the two compared items use the same character set, but their collations are _bin and a_ci or _cs, the_bin collation is used.

    Examples

    obclient> SELECT COERCIBILITY('oceanbase' COLLATE utf8mb4_bin);
    +-----------------------------------------------+
    | COERCIBILITY('oceanbase' COLLATE utf8mb4_bin) |
    +-----------------------------------------------+
    |                                             0 |
    +-----------------------------------------------+
    1 row in set
    
    obclient> SELECT COERCIBILITY('oceanbase');
    +---------------------------+
    | COERCIBILITY('oceanbase') |
    +---------------------------+
    |                         4 |
    +---------------------------+
    1 row in set
    
    obclient> SELECT COERCIBILITY(USER());
    +----------------------+
    | COERCIBILITY(USER()) |
    +----------------------+
    |                    3 |
    +----------------------+
    1 row in set
    
    obclient> SELECT COERCIBILITY(1000);
    +--------------------+
    | COERCIBILITY(1000) |
    +--------------------+
    |                  5 |
    +--------------------+
    1 row in set
    

    Previous topic

    CHARSET
    Last

    Next topic

    COLLATION
    Next
    What is on this page
    Syntax
    Purpose
    Examples