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

    SET TRANSACTION

    Last Updated:2026-04-09 09:38:52  Updated
    share
    What is on this page
    Purpose
    Syntax
    Parameters
    Examples

    folded

    share

    Purpose

    You can use this statement to set the transaction isolation level.

    OceanBase Database supports two isolation levels in MySQL mode: read committed and repeatable read. The default isolation level is read committed.

    • You cannot set the isolation level during transaction execution. Otherwise, an error is returned.

      ERROR:ORA-01453: SET TRANSACTION must be first statement of transaction

    • You need to make sure that Global Timestamp Service (GTS) is enabled before you enable the serializable isolation level.

    • When you run session transactions, you need to set the isolation level to the session level. This isolation level can be overridden by isolation levels at the transaction level.

    Syntax

    SET [GLOBAL | SESSION | LOCAL] TRANSACTION trans_opt;
    
    trans_opt:
       transaction_access_mode
     | isolation_level
     | transaction_access_mode, isolation_level
     | isolation_level, transaction_access_mode
    
    transaction_access_mode:
        [READ ONLY | READ WRITE]
    
    isolation_level:
        ISOLATION LEVEL {
          READ UNCOMMITED
        | READ COMMITED
        | REPEATABLE READ
        | SERIALIZABLE
      }
    

    Parameters

    Parameter Description
    GLOBAL | SESSION | LOCAL The effective scope of the transaction isolation level. This parameter is unspecified by default.
    • GLOBAL: indicates that the transaction isolation level applies to all subsequent sessions, without affecting the current session.
    • SESSION \| LOCAL: indicates that the transaction isolation level applies to all transactions subsequently executed in the current session, without affecting the transaction in progress. If this statement is executed in an interval between transactions, it overrides any statement that previously sets the next transaction value of the naming feature.
    • Unspecified: indicates that the transaction isolation level applies to the next single transaction executed in the session. Subsequent transactions continue to use the session value of the naming feature.
    READ ONLY | READ WRITE The read/write mode of the transaction.
    READ UNCOMMITED Specifies that the transaction isolation level is read uncommitted.
    Note: The current version does not support the read uncommitted isolation level.
    READ COMMITED Specifies that the transaction isolation level is read committed.
    REPEATABLE READ Specifies that the transaction isolation level is repeatable read.
    SERIALIZABLE Specifies that the transaction isolation level is serializable.
    Note: OceanBase Database does not support the serializable isolation level for the sys tenant because GTS cannot be enabled for the sys tenant.

    Examples

    • Set the transaction isolation level of the next transaction in the current session to read committed.

       obclient> SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
      
    • Set the transaction isolation level of the current session to repeatable read.

       obclient> SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
      

    Previous topic

    SET ROLE
    Last

    Next topic

    SHOW
    Next
    What is on this page
    Purpose
    Syntax
    Parameters
    Examples