../E23381-01.epub /> ../E23381-01.mobi />

TO_NUMBER

TO_NUMBER converts a text expression containing a number to a value of NUMBER data type.

Return Value

NUMBER

Syntax

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

Arguments

expr is an expression to be converted to a number.

fmt is a text expression that identifies a number format model as described in the Oracle Database SQL Language Reference.

nlsparam specifies the characters used by these number format elements:

  • Decimal character

  • Group separator

  • Local currency symbol

  • International currency symbol

This argument has the format shown here:

'NLS_NUMERIC_CHARACTERS = ''dg''
 NLS_CURRENCY = ''text''
 NLS_ISO_CURRENCY = territory '

The d is the decimal character, and the g is the group separator. They must be different single-byte characters. Within the quoted string, use two single quotation marks around the parameter values. Ten characters are available for the currency symbol.

If you omit this argument or any of the NLS parameters, then this function uses the default values for your session to interpret expr.

Examples

TO_NUMBER('$1,234,567.89', 'L999G999G999D99') returns the value 1234567.89.

TO_NUMBER('EUR1,234,567.89', 'C999G999G999D99', 'NLS_ISO_CURRENCY=SPAIN') also returns the value 1234567.89.