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.1.0Enterprise Edition

    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.1.0
    iconOceanBase Database
    SQL - V 4.1.0Enterprise Edition
    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

    NANVL

    Last Updated:2023-07-28 02:53:17  Updated
    share
    What is on this page
    Purpose
    Syntax
    Parameters
    Return type
    Examples

    folded

    share

    Purpose

    NANVL() determines whether the input value n1 is not a number (NaN) and returns the result.

    • If n1 is NaN, the function returns n2.

    • If n1 is not NaN, the function returns n1.

      Notice

      This function applies only for the BINARY_FLOAT and BINARY_DOUBLE data types.

    Syntax

    NANVL(n1,n2)
    

    Parameters

    Parameter Description
    n1 An expression of a numeric data type such as BINARY_FLOAT or BINARY_DOUBLE or any data type that can be implicitly converted to a numeric data type.
    n2 An expression of a numeric data type such as BINARY_FLOAT or BINARY_DOUBLE or any data type that can be implicitly converted to a numeric data type.

    Return type

    • If any of the parameters is of the BINARY_DOUBLE data type, the return type is BINARY_DOUBLE.

    • If any of the parameters is of the BINARY_FLOAT data type, the return type is BINARY_FLOAT.

    • If any of the parameters is null, the function returns NULL.

    Examples

    • Create the tbl1 table and insert test data into the table. If column col2 is a number, the function returns the original value. Otherwise, it returns 0.

      obclient> CREATE TABLE tbl1 (col1 NUMBER(10,2), col2 BINARY_DOUBLE, col3 BINARY_FLOAT);
      Query OK, 0 rows affected
      
      obclient> INSERT INTO tbl1 VALUES(1,1,1),(2,'NaN',2),(3,3,'NaN');
      Query OK, 3 rows affected
      Records: 3  Duplicates: 0  Warnings: 0
      
      obclient> SELECT * FROM tbl1;
      +------+----------+----------+
      | COL1 | COL2     | COL3     |
      +------+----------+----------+
      |    1 | 1.0E+000 | 1.0E+000 |
      |    2 |      Nan | 2.0E+000 |
      |    3 | 3.0E+000 |      Nan |
      +------+----------+----------+
      3 rows in set
      
      obclient> SELECT col2,NANVL(col2,0) FROM tbl1;
      +----------+---------------+
      | COL2     | NANVL(COL2,0) |
      +----------+---------------+
      | 1.0E+000 |      1.0E+000 |
      |      Nan |             0 |
      | 3.0E+000 |      3.0E+000 |
      +----------+---------------+
      3 rows in set
      
    • If any of the parameters is null, the function returns NULL.

      obclient> SELECT NANVL('',1),NANVL(2,'') FROM DUAL;
      +-------------+-------------+
      | NANVL('',1) | NANVL(2,'') |
      +-------------+-------------+
      |        NULL |        NULL |
      +-------------+-------------+
      1 row in set
      

    Previous topic

    MOD
    Last

    Next topic

    POWER
    Next
    What is on this page
    Purpose
    Syntax
    Parameters
    Return type
    Examples