OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
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

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
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.0

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & CertificationTicket
    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.0
    iconOceanBase Database
    SQL - V 4.2.0
    SQL
    KV
    • V 4.6.0
    • 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

    Numeric data types

    Last Updated:2023-10-31 11:17:12  Updated
    share
    What is on this page
    NUMBER
    Floating-point numbers

    folded

    share

    Numeric data types use numeric literals to specify fixed and floating-point numbers. Some numeric data types also support zero, infinity, and not-a-number (NaN) values. This topic describes the NUMBER type and floating-point numbers.

    NUMBER

    The NUMBER type stores fixed-point and floating-point numbers. This type can store numbers of virtually any order of magnitude.

    • Precision

      The precision specifies the total number of digits of a number. If the precision is not specified, the original number provided is stored without rounding.

    • Scale

      The scale specifies the number of digits from the decimal point to the least significant digit. A positive scale counts digits to the right of the decimal point up to and including the least significant digit. A negative scale counts digits to the left of the decimal point. If you specify a precision without a scale, for example, NUMBER(6), the scale is 0.

    A numeric literal can store a number with a maximum precision of 38 digits. If the precision of a literal is higher than that supported by the NUMBER, BINARY_FLOAT, or BINARY_DOUBLE data type, OceanBase Database truncates the literal. If the range of a literal exceeds the boundaries supported by the NUMBER, BINARY_FLOAT, or BINARY_DOUBLE data type, OceanBase Database returns an error.

    For example, NUMBER(8,2) indicates a precision of 8 and a scale of 2. Therefore, the database stores 100,000 as 100000.00.

    Sample valid values of the NUMBER type are as follows:

    12
    +6.87
    0.5
    25e-03
    -9
    

    Sample valid values of the floating-point type are as follows:

    25f
    +6.34F
    0.5d
    -1D
    

    Floating-point numbers

    OceanBase Database provides two numeric data types exclusively for floating-point numbers: BINARY_FLOAT and BINARY_DOUBLE.

    These types support all basic features provided by the NUMBER type. However, the NUMBER type uses decimal precision, whereas the BINARY_FLOAT and BINARY_DOUBLE types use binary precision. Binary precision enables faster arithmetic calculations and usually reduces storage requirements.

    BINARY_FLOAT and BINARY_DOUBLE are approximate numeric data types. They store approximate representations, rather than exact representations, of decimal values. For example, the value 0.1 cannot be exactly represented by the BINARY_DOUBLE or BINARY_FLOAT type. These types are often used in scientific calculations. They function like the FLOAT and DOUBLE types in Java.

    Sample valid floating-point numbers are as follows:

    1.2
    -1.1
    0.
    

    In addition to the NUMBER and floating-point types, numeric data types also support special representations such as positive infinity, negative infinity, and NaN representations. The following special representations are supported:

    • binary_double_infinity

    • binary_double_nan

    • binary_float_infinity

    • binary_float_nan

    Previous topic

    Character data types
    Last

    Next topic

    Date and time data types
    Next
    What is on this page
    NUMBER
    Floating-point numbers