Convert a string expression to a number
Syntax to_number(char[,'format'[,nls_lang]) Key char String expression that will be converted to a number format Date format to use. nls_lang The international language to use.
You can convert a character or expression
that contains a number into an actual number value.
The 'format' must be a valid Number format.
nls_lang allows international formats to be applied e.g. currency symbols and
numeric chars.
ORA-01722: invalid number - error thrown if TO_NUMBER is passed a string that doesn't represent a number. See René Nyffenegger's safe_to_number function.
Examples
SQL> Select to_number('1234.64') from Dual;
1234.64
SQL> Select to_number('1234.64', '9999.9') from Dual;
1234.6
SQL> Select to_number('$99.64', 'L99D99') from Dual;
99.64
Related
CONVERT - Convert a string from one character set to another.
TO_CHAR - Convert to character String
TO_DATE - Convert to date format
Oracle SQL Functions
ORA-00932 inconsistent datatypes