All Products
Search
Document Center

TO_NUMBER

Last Updated: Jun 18, 2021

The TO_NUMBER function converts expr to a value of the numeric data type. expr can be a value of the CHAR, VARCHAR2, NCHAR, NVARCHAR2, BINARY_FLOAT, or BINARY_DOUBLE data type.

Syntax

TO_NUMBER(expr [, fmt [, 'nlsparam' ] ])

Parameters

Parameter

Description

expr

The value of the CHAR, VARCHAR2, NCHAR, NVARCHAR2, BINARY_FLOAT, or BINARY_DOUBLE data type.

fmt

The format model.

nlsparam

The supported language is obtained from sys.V_$NLS_VALID_VALUES.

Return type

The data of the NUMBER type is returned.

Examples

Execute the following statement:

SELECT TO_NUMBER('199912'),TO_NUMBER('450.05') FROM DUAL;

The following query result is returned:

+---------------------+---------------------+
| TO_NUMBER('199912') | TO_NUMBER('450.05') |
+---------------------+---------------------+
|              199912 |              450.05 |
+---------------------+---------------------+