TO_CHAR (Numbers)
Converts numeric values to text strings. TO_CHAR also converts dates to strings.
TO_CHAR converts numeric values to text strings as follows:
- •Converts double values to strings of up to 16 digits and provides accuracy up to 15 digits. If you pass a number with more than 15 digits, TO_CHAR rounds the number to the sixteenth digit.
- •Returns decimal notation for numbers in the ranges (-1e16,-1e-16] and [1e-16, 1e16). TO_CHAR returns scientific notation for numbers outside these ranges.
Note: Informatica Cloud converts the values 1e-16 and -1e16 to scientific notation, but returns the values 1e-16 and -1e-16 in decimal notation.
Syntax
TO_CHAR( numeric_value )
Argument | Required/ Optional | Description |
---|
numeric_value | Required | Numeric datatype. The numeric value you want to convert to a string. You can enter any valid expression. |
Return Value
String.
NULL if a value passed to the function is NULL.
Example
The following expression converts the values in the SALES column to text:
TO_CHAR( SALES )
SALES | RETURN VALUE |
---|
1010.99 | '1010.99' |
-15.62567 | '-15.62567' |
10842764968208837340 | '1.084276496820884e+019' (rounded to 16th digit) |
1.234567890123456789e-10 | '0.0000000001234567890123457'(greater than 1e-16 but less than 1e16) |
1.23456789012345e17 | '1.23456789012345e17' (greater than 1e16) |
0 | '0' |
33.15 | '33.15' |
NULL | NULL |