PL/SQL To_number

The TO_NUMBER function converts a TEXT expression to a number.

To_number syntax

TO_NUMBER( text, [ format_mask ], [ nls_params ] )

To_number example

 
select to_number('1234.82', '9999.99') from dual;	

Result: 1234.82


select to_number('1234.82', '9999.00') from dual;

Result: 1234.82


select to_number('389', '999') from dual;	

Result: 389


select to_number('74', '99') from dual;	

Result: 74


select to_number('-$17,107.28', '$99,999.99') from dual;

Result: -17107.28


select to_number('$17,107,789.28', '$999,999,999.99') from dual;

Result: 17107789.28