In Oracle, you can use the to_char() function to convert numbers into strings. This function can convert numbers into strings in a specified format. The syntax is "SELECT TO_CHAR (number, format to be converted) [ FROM data table];".
The operating environment of this tutorial: Windows 7 system, Oracle 11g version, Dell G3 computer.
In Oracle, you can use the to_char() function to convert numbers into strings.
Syntax:
TO_CHAR(d|n[,fmt])
Can convert dates and numbers into strings in a specified format. Fmt is the format string
for the formatting of numbers. The formatting characters are:
Parameters | Example | Description |
##9 | 999 | Display the number at the specified position |
. | 9.9 | Returns the decimal point at the specified position |
, | 99,99 | Returns a comma at the specified position |
$ | $999 | Returns a dollar sign at the beginning of the number |
EEEE | 9.99EEEE | Scientific notation |
L | L999
| Add a local currency symbol before the number |
PR | 999PR | If the number is negative, use angle brackets to indicate it |
Description | |
---|---|
A value with the specified number of digits | |
Values with leading zeros | |
decimaldot | |
Group (thousands) delimiter | |
Negative values in angle brackets | |
Negative value with negative sign (use localization) | |
Currency symbol (use localization) | |
DecimalDot (use localization) | |
Group separator (use localization) | |
Minus sign at specified position (if number < 0) | |
Positive sign at the indicated position (if number > 0) | |
Positive/negative sign at the indicated position | |
Roman numerals (enter between 1 and 3999) | |
Convert to ordinal numbers | |
Move | n digits (decimal) (see notes) |
Scientific notation. Not supported now. |
SELECT TO_CHAR(-123123.45,'L9.9EEEEPR')"date" FROM dual;
Oracle Tutorial》
The above is the detailed content of How to convert number to string in oracle. For more information, please follow other related articles on the PHP Chinese website!