How Can We Help?
Introduction:
In this tutorial, we are going to explain how to use Oracle TO_NUMBER function with basic syntax and many examples for better understanding.
TO_NUMBER function convert characters to a number.
Syntax:
TO_NUMBER(string, [format_mask], [nls_parameter] )
- string: The string you want to convert to number.
- format_mask: The format that we can use to convert the value to a string.
- nls_parameter : nls_lang specified to convert value to number in particular language.
Applies to::
Oracle 19c, Oracle 18c, Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i
Examples:
Let’s take some examples about Oracle TO_NUMBER and how to use it:
SELECT TO_NUMBER(5340.86, '9999.99')
FROM DUAL;
SELECT TO_NUMBER('21')
FROM DUAL;
Similar oracle functions:
TO_DATE – converts a string value to a DATE type.
TO_CHAR – converts a value to a NUMBER type
CAST – used for many types, including dates
In this tutorial, you have learned how to use the Oracle TO_NUMBER function to convert characters to a number .
Hopefully, it was clear and concise.