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 Developer Center

V4.4.0

  • Topics Overview
  • Overview
    • What is ODC?
    • Features
    • Architecture
    • Limitations
    • ODC console
  • Quick Start
    • Client ODC
      • Overview
      • Install Client ODC
      • Use Client ODC
    • Web ODC
      • Overview
      • Deploy Web ODC
      • Use Web ODC
  • Data Source Management
    • Create a data source
    • Data sources and project collaboration
    • Database O&M
      • Session management
      • Global variable management
      • Recycle bin management
  • SQL Development
    • Edit and execute SQL statements
    • Perform PL compilation and debugging
    • Use the command-line window
    • Edit and export the result set of an SQL statement
    • Execution analysis
    • Generate test data
    • System settings
    • Database objects
      • Table objects
        • Overview
        • Create a table
      • View objects
        • Overview
        • Create a view
        • Manage views
      • Materialized view objects
        • Overview
        • Create a materialized view
        • Manage materialized views
      • Function objects
        • Overview
        • Create a function
        • Manage functions
      • Stored procedure objects
        • Overview
        • Create a stored procedure
        • Manage stored procedures
      • Sequence objects
        • Overview
        • Create a sequence
        • Manage sequences
      • Package objects
        • Overview
        • Create a program package
        • Manage program packages
      • Trigger objects
        • Overview
        • Create a trigger
        • Manage triggers
      • Type objects
        • Overview
        • Create a type
        • Manage types
      • Synonym objects
        • Overview
        • Create a synonym
        • Manage synonyms
  • Import and Export
    • Import schemas and data
    • Export schemas and data
  • Database Change Management
    • Manage user permissions
      • Users and roles
      • Automatic authorization
      • User permission management
    • Project collaboration management
    • Risk levels, risk identification rules, and approval processes
    • SQL check specifications
    • SQL window specification
    • Database change management
    • Manage changes to logical databases
    • Batch database change management
    • Online schema changes
    • Synchronize shadow tables
    • Schema comparison
  • Data Lifecycle Management
    • Data archiving
    • Data cleanup
    • Manage partitioning plans
      • Manage partitioning plans
      • Set partitioning strategies
      • Examples of partitioning strategies
    • SQL plan task
  • Data Masking and Auditing
    • Desensitize data
    • Operation records
  • Notification Management
    • Overview
    • View notification records
    • Manage notification channels
      • Create a notification channel
      • View, edit, and delete a notification channel
      • Configure a custom channel
    • Manage notification rules
  • System Integration
    • Login integration
    • Approval integration
    • SQL approval integration
    • Bastion host integration
  • Deployment Guide
    • Deployment overview
    • Preparations before deployment
    • Deploy ODC in single-node mode
    • Deploy ODC in high-availability mode
    • Deployment verification
  • Upgrade Guide
    • Upgrade Overview
    • Preparations before upgrade
    • Update single-node ODC
    • Update high-avaliability ODC
    • Upgrade verification
    • Rollback after upgrade failed
  • Best Practices
    • Tips for SQL development
    • Explore ODC team workspaces
    • Understanding real-time SQL diagnostics for OceanBase AP
    • OceanBase historical database solutions
    • ODC SQL check for automatic identification of high-risk operations
    • Integration with ODC enterprise-level account system
    • Manage and modify sharded databases and tables via ODC
    • Data masking and control practices
    • Enterprise-level control and collaboration: Safeguard every database change
  • Troubleshooting
    • ODC troubleshooting process
    • Collect message
      • View the runtime environment and version information
      • View web ODC logs
      • View client ODC logs
      • View end-to-end ODC-related logs
      • View ODC MetaDB data
      • Query the index status in OceanBase Database V4.x
      • Query the index status in OceanBase Database V1.4.x to V3.2.x
      • Collect JVM runtime information
      • Use tcpdump to capture packets
    • FAQ
      • Installation of client ODC
      • Web ODC deployment and startup
      • Connection Information
      • Command-line window
      • DDL statement display
  • Common features
  • Release Notes
    • V4.4
      • ODC V4.4.0
    • V4.3
      • ODC V4.3.4
      • ODC V4.3.3
      • ODC V4.3.2
      • ODC V4.3.1
      • ODC V4.3.0
    • V4.2
      • ODC V4.2.4
      • ODC V4.2.3
      • ODC V4.2.2
      • ODC V4.2.1
      • ODC V4.2.0
    • V4.1
      • ODC V4.1.3
      • ODC V4.1.2
      • ODC V4.1.1
      • ODC V4.1.0
    • V4.0
      • ODC V4.0.2
      • ODC V4.0.0
    • V3.4
      • ODC V3.4.0
    • V3.3
      • ODC V3.3.3
      • ODC V3.3.2
      • ODC V3.3.1
      • ODC V3.3.0
    • V3.2
      • ODC V3.2.3
      • ODC V3.2.2
      • ODC V3.2.1
      • ODC V3.2.0

Download PDF

Topics Overview What is ODC? Features Architecture Limitations ODC console Overview Install Client ODC Use Client ODC Overview Deploy Web ODC Use Web ODC Create a data source Data sources and project collaboration Session management Global variable management Recycle bin management Edit and execute SQL statements Perform PL compilation and debugging Use the command-line window Edit and export the result set of an SQL statement Execution analysis Generate test data System settings Import schemas and data Export schemas and data Users and roles Automatic authorization User permission management Project collaboration management Risk levels, risk identification rules, and approval processes SQL check specifications SQL window specification Database change management Manage changes to logical databases Batch database change management Online schema changes Synchronize shadow tables Schema comparison Data archiving Data cleanup Manage partitioning plans Set partitioning strategies Examples of partitioning strategies SQL plan task Desensitize data Operation records Overview View notification records Create a notification channel View, edit, and delete a notification channel Configure a custom channel Manage notification rules Login integration Approval integration SQL approval integration Bastion host integration Deployment overview Preparations before deployment Deploy ODC in single-node mode Deploy ODC in high-availability mode Deployment verification Upgrade Overview Preparations before upgrade Update single-node ODC Update high-avaliability ODC Upgrade verification Rollback after upgrade failed Tips for SQL development Explore ODC team workspaces Understanding real-time SQL diagnostics for OceanBase AP OceanBase historical database solutions ODC SQL check for automatic identification of high-risk operations Integration with ODC enterprise-level account system Manage and modify sharded databases and tables via ODC Data masking and control practices Enterprise-level control and collaboration: Safeguard every database change ODC troubleshooting process View the runtime environment and version information View web ODC logs View client ODC logs View end-to-end ODC-related logs View ODC MetaDB data Query the index status in OceanBase Database V4.x Query the index status in OceanBase Database V1.4.x to V3.2.x Collect JVM runtime information Use tcpdump to capture packets Installation of client ODC Web ODC deployment and startup Connection Information Command-line window DDL statement display Common features ODC V4.4.0 ODC V4.3.4 ODC V4.3.3 ODC V4.3.2 ODC V4.3.1 ODC V4.3.0 ODC V4.2.4
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 Developer Center
  3. V4.4.0
iconOceanBase Developer Center
V 4.4.0
  • V 4.4.2
  • V 4.4.1
  • V 4.4.0
  • V 4.3.4
  • V 4.3.3
  • V 4.3.2
  • V 4.3.1
  • V 4.3.0
  • V 4.2.4
  • V 4.2.3
  • V 4.2.2
  • V 4.2.1
  • V 4.2.0
  • V 4.1.3 and earlier

Edit and execute SQL statements

Last Updated:2026-04-07 10:00:35  Updated
share
What is on this page
Background information
Prerequisites
Edit SQL statements
Execute SQL statements
View data
SQL scripts
Save a script
Manage scripts
Snippets
Create a snippet
Manage snippets
References

folded

share

This topic describes how to edit and execute SQL statements in the SQL window.

Background information

The SQL window of ODC provides a GUI for data processing. You can sort, filter, add, edit, and delete data, and execute database objects in the SQL window.

The following example describes how to create a table named employee in the odc_test database in the SQL window.

Note

All data in this example is for reference only. You can replace the data as needed.

Prerequisites

You have queried, exported, or modified the database.

Note

If you do not have the database permissions, you can click Apply for Database Permissions in Tickets to apply for the corresponding query/export/modify permissions.

Edit SQL statements

  1. Click the name of the odc_test project, test_data, to go to the SQL window.

    1

  2. In the SQL window, enter an SQL statement to create a table named employee.

    2

    CREATE TABLE test_data.employee (emp_no int(120) COMMENT 'Employee ID' NOT NULL, birthday date COMMENT 'Birthday' NULL,name varchar(120) COMMENT 'Employee name' NULL,CONSTRAINT cons_employee_empno PRIMARY KEY (emp_no)) DEFAULT CHARSET = utf8mb4    COLLATE = utf8mb4_general_ci;
    

    The syntax is as follows:

    CREATE TABLE table_name (column_name column_type, column_name column_type,.......);
    

    The following table describes the parameters.

    Parameter Description
    CREATE TABLE The statement that creates a table with a specified name. You must have the privilege to create tables.
    table_name The name of the table. The table name must conform to the identifier naming rules.
    column_name column_type The name and data type of each column in the table. Separate the tuples of multiple columns with commas (,).
    • You can click the name of a database in the SQL window to switch to the database.

      3

Execute SQL statements

  1. After you write SQL statements, click Run F8 in the toolbar to run all SQL statements in the current SQL window.

    Feature Description
    Run F8 Click this option to run all SQL statements in the current SQL window. You can also press F8 to run all SQL statements.
    Run Current Statement (F9) Click this option to run all selected SQL statements or the statement in the line where the pointer is located. You can also press Ctrl+Enter (Windows) or Command+Enter (MacOS) to run the current statement.
    Abort Click this option to abort the statement that is being executed.

    4

  2. On the result tabs, view the status and results of statement execution.

    5

View data

  1. In the left-side navigation pane of the SQL window, verify that the employee table exists in the database icon.

    odc_test > test_data > table > employee
    

    6

    • Enter a keyword in the search box, or press the shortcut key Ctrl+J (Windows) / Command+J (MacOS) to open the search drop-down list and enter a keyword. You can search for all objects such as databases, tables, views, and functions in the current project or data source.

      7

  2. You can group databases by different conditions.

    8

  3. Click 8.1 to manually synchronize metadata of tables and columns in the current project or data source.

  4. Right-click the employee table or edit a SELECT statement in the SQL window to view the table data.

    9

  5. Right-click the name of the database and select Sync Metadata to manually synchronize metadata of tables and columns in the database.

    10

SQL scripts

ODC allows you to save and edit scripts in an SQL window or an anonymous block window. You can also manage the saved scripts on the script tabs.

Save a script

Save the script that creates the employee table in an SQL window.

Parameter Example value
Table name employee
Script name create_employee
  1. In the SQL window, click the Save Script icon on the toolbar.

    11

  2. Specify the script name and click OK.

    12

Manage scripts

  1. In the left-side navigation pane of the SQL window, click script to go to the script management page.

    13

  2. On the Script page, you can edit, download, or delete saved scripts, copy the path of a script, and upload a script from your local disk.

    You can double-click a script name to directly reference the script content in the SQL window. You can also copy the path to reference the script content in the command line window.

    14

    When you download a script, you can select multiple scripts for batch download.

    Note

    You can download up to 200 scripts in a batch.

    1. Click the name of the script that you want to download.

    2. Use the ctrl (Windows) or command (MacOS) key together with left mouse button to select more scripts, or use the shift key together with left mouse button to select scripts in a range.

      18

    3. Right-click to select Download in bulk.

Snippets

ODC allows you to create snippets. You can query and view the usage of related statements in the snippets during development.

Create a snippet

Save the snippet that creates the employee table on the snippets page.

Parameter Example value
Table name employee
Snippet name create_table
  1. In the left-side navigation pane of the SQL window, click script and click + to create a snippet on the code snippets tab.

    15

  2. On the Create Code Segment page, specify the snippet information and click OK.

    16

    Note

    In ODC V4.2.3 and later, the maximum length of a snippet is 64 KB.

Manage snippets

On the snippets page, you can copy, edit, delete, and refresh saved snippets.

17

References

  • Compile and debug PL programs

  • Command-line window

  • Result editing and exporting

  • Execution analysis

  • Generate test data

  • Database change management

  • Manage partitioning plans

  • Synchronization of shadow tables

  • Online schema changes

Previous topic

Recycle bin management
Last

Next topic

Perform PL compilation and debugging
Next
What is on this page
Background information
Prerequisites
Edit SQL statements
Execute SQL statements
View data
SQL scripts
Save a script
Manage scripts
Snippets
Create a snippet
Manage snippets
References