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

    Overview

    Last Updated:2026-04-15 08:27:15  Updated
    share
    What is on this page
    Datetime data types
    Interval data types
    Related fields and values
    More information

    folded

    share

    Like Oracle, OceanBase Database also supports datetime and interval data types. This topic describes the datetime and interval data types supported by OceanBase Database.

    Datetime data types

    The datetime data types store date and time information. The following table lists the datetime data types supported by OceanBase Database.

    Data type Description
    DATE The date and time, which is accurate to seconds and contains no time zone.
    TIMESTAMP It is an extended type of the DATE data type, which is accurate to nanoseconds and contains no time zone.
    TIMESTAMP WITH TIME ZONE It is an extended type of the DATE data type, which is accurate to nanoseconds and contains the time zone.
    TIMESTAMP WITH LOCAL TIME ZONE The TIMESTAMP with local time zone information, which stores database time zone.

    Interval data types

    The interval data types store a period of time, unlike the datetime data types that store a specific point in time. The interval data types store the difference between two datetime values. The following table lists the interval data types.

    Data type Description
    INTERVAL YEAR TO MONTH The time interval in years and months.
    INTERVAL DAY TO SECOND The time interval in days, hours, minutes, and seconds.

    Related fields and values

    Datetime and interval data consist of fields, and the values of these fields decide the value of the data types.

    Field Value range of datetime Value range of interval
    YEAR [-4712,9999], excluding year 0. Any positive or negative integer.
    MONTH [01,12] [0,11]
    DAY [01,31]. The value range is determined by the values of MONTH and YEAR and complies with the rule of the NLS calendar. Any positive or negative integer.
    HOUR [00,23] [0,23]
    MINUTE [00,59] [0,59]
    SECOND [00,59.9(n)], where 9(n) is the precision of time fractional seconds. 9(n) does not apply to DATE. [0,59.9(n)], where 9(n) is the precision of interval fractional seconds.
    TIMEZONE_HOUR [-12,14]. This range applies to daylight saving time and does not apply to DATE or TIMESTAMP. N/A
    TIMEZONE_MINUTE [00,59]. This range does not apply to DATE or TIMESTAMP. N/A
    TIMEZONE_REGION You can query the TZNAME column of the V$TIMEZONE_NAMES data dictionary view to get the value range. This range does not apply to DATE or TIMESTAMP. N/A
    TIMEZONE_ABBR You can query the TZABBREV column of the V$TIMEZONE_NAMES data dictionary view to get the value range. This range does not apply to DATE or TIMESTAMP. N/A

    More information

    • For more information about the DST, see DST.

    • For more information about the calculation of the DATE and INTERVAL data types, see Calculation of dates, timestamps, and intervals.

    Previous topic

    Precedence of numeric data types
    Last

    Next topic

    DATE data type
    Next
    What is on this page
    Datetime data types
    Interval data types
    Related fields and values
    More information