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

    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.4.2
    iconOceanBase Database
    SQL - V 4.4.2
    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

    CREATE FORMAT OUTLINE

    Last Updated:2026-04-02 06:23:57  Updated
    share
    What is on this page
    Purpose
    Limitations and considerations
    Syntax
    Parameters
    Examples
    References

    folded

    share

    Purpose

    This statement is used to create a fuzzy outline. A fuzzy outline can be created in two ways: one is by using FORMAT_SQL_TEXT (the parameterized original statement executed by the user), and the other is by using FORMAT_SQL_ID.

    Limitations and considerations

    • To create an outline, you must execute the statement under the corresponding user.

    • When FORMAT_SQL_ID is the same, the outline created by using FORMAT_SQL_TEXT will overwrite the outline created by using FORMAT_SQL_ID. The outline created by using FORMAT_SQL_TEXT has a higher priority. Additionally, OceanBase Database distinguishes different SQL statements by using FORMAT_SQL_ID, which is generated by taking the MD5 hash of FORMAT_SQL_TEXT. In a production system, it is recommended to bind outlines by using FORMAT_SQL_ID.

      Note

      • The matching rules of FORMAT_SQL_TEXT ignore changes in parameters, case differences, and non-syntactic symbols such as spaces and line breaks. For an IN expression, normalization is performed, and only the text content after these processing steps is compared.
      • FORMAT_SQL_ID is generated by first formatting FORMAT_SQL_TEXT (removing extra spaces and line breaks, and converting all characters to uppercase or lowercase), and then applying the MD5 hash encryption to the formatted result.

    Syntax

    /* Create an outline by using FORMAT_SQL_TEXT */
    CREATE [OR REPLACE] FORMAT OUTLINE outline_name ON format_stmt [ TO format_target_stmt ]
    
    /* Create an outline by using FORMAT_SQL_ID */
    CREATE [OR REPLACE] FORMAT OUTLINE outline_name ON format_sql_id USING HINT hint;
    

    Parameters

    Parameter Description
    outline_name The name of the fuzzy outline to be created.
    OR REPLACE If you specify OR REPLACE, and the outline to be created already exists, the existing outline will be replaced.
    format_stmt The original SQL statement, which is the SQL statement or operation to which the outline will be applied.

    Note

    OceanBase Database automatically converts unformatted SQL text into formatted SQL text internally.

    TO format_target_stmt Optional. Specifies the target SQL statement to which format_stmt will be converted or applied. This allows the outline to also be applicable to other SQL statements. You can use the TO format_target_stmt option to declare these SQL statements.

    Notice

    • If you want to fix the plan for a statement containing a hint, use format_target_stmt to specify the original SQL.
    • When using the TO format_target_stmt clause, the original SQL format_stmt must match format_target_stmt after removing hints and formatting.

    format_sql_id The format_stmt obtained after a series of rules are applied to the SQL statement to be bound, and then the MD5 value is calculated based on format_stmt to obtain format_sql_id.

    Examples

    • Create an outline by using FORMAT_SQL_TEXT.

      CREATE FORMAT OUTLINE my_outline ON SELECT * FROM employees WHERE department_id = ?;
      
    • Create an outline by using FORMAT_SQL_ID.

      CREATE FORMAT OUTLINE my_sql_id_outline ON 'ED570339F2C856BA96008A29EDF04C74' USING HINT /*+ index(t1 idx_c2)*/;
      
      

    References

    For more information about using outlines, see Plan binding.

    Previous topic

    CREATE OUTLINE
    Last

    Next topic

    CREATE RESTORE POINT
    Next
    What is on this page
    Purpose
    Limitations and considerations
    Syntax
    Parameters
    Examples
    References