TO NUMBER

From Oracle FAQ
⧼orafaq-jumptonavigation⧽⧼orafaq-jumptosearch⧽

TO_NUMBER is a SQL function used to convert a string to a NUMBER value.

Syntax

The syntax for the TO_NUMBER function is:

to_number( string, [ format_mask ], [ nls_language ] )

Where:

  • string is the string that will be converted to a number.
  • format_mask is optional. This is the format that will be used to convert the string to a number.
  • nls_language is also optional. This is the NLS language (regional settings) used to convert the string to a number.

Examples

SQL> SELECT TO_NUMBER('$1234.56', '$9999.99') FROM dual;
TO_NUMBER('$1234.56','$9999.99')
--------------------------------
                         1234.56

Also see

  • IS_NUMBER, checking if a string is numeric.
  • TO_DATE, function to convert a string to a date.
  • TO_CHAR, function to convert a number or date to a string.