List of Number Format Elements in Oracle

Below is a full list of the format elements that can be used to format numbers in Oracle Database.

ElementExampleDescription
,9,999Returns a comma in the specified position. You can specify multiple commas. A number format model cannot begin with a comma. Also, a comma cannot appear to the right of a decimal character or period.
.99.99Returns a decimal point, which is a period (.) in the specified position. Only one period is allowed in a number format model.
$$9999Returns value with a leading dollar sign.
0099990Returns leading zeros and/or trailing zeros.
99999Returns value with the specified number of digits with a leading space if positive or with a leading minus if negative. Leading zeros are blank, except for a zero value, which returns a zero for the integer part of the fixed-point number.
BB9999Returns blanks for the integer part of a fixed-point number when the integer part is zero (regardless of zeros in the format model).
CC999ISO currency symbol (the current value of the NLS_ISO_CURRENCY parameter).
D99D99Returns the decimal character, which is the current value of the NLS_NUMERIC_CHARACTER parameter. The default is a period (.). Only one decimal character is allowed in a number format model.
EEEE9.9EEEEReturns the value using scientific notation.
G9G999Group separator (the current value of the NLS_NUMERIC_CHARACTER parameter). You can specify multiple group separators in a number format model, but a group separator cannot appear to the right of a decimal character or period.
LL999Local currency symbol (the current value of the NLS_CURRENCY parameter).
MI9999MIReturns negative values with a trailing minus sign (-). Returns positive value with a trailing blank. Only allowed in the last position of a number format model.
PR9999PRReturns negative value in angle brackets (<>). Returns positive value with a leading and trailing blank. Only allowed in the last position of a number format model.
RNRNReturns the value as Roman numerals in uppercase. Value can be an integer between 1 and 3999.
rnrnReturns the value as Roman numerals in lowercase. Value can be an integer between 1 and 3999.
SS9999
9999S
Returns negative values with a leading or trailing minus sign (-). Returns positive values with a leading or trailing plus sign (+). Only allowed in the first or last position.
TMTMThe text minimum number format model returns (in decimal output) the smallest number of characters possible. Case insensitive. The default is TM9, which returns the number in fixed notation unless the output exceeds 64 characters. If the output exceeds 64 characters, then the number is returned in scientific notation.

You cannot precede this element with any other element. You can follow this element only with one 9 or one E (or e), but not with any combination of these.
UU9999Returns in the specified position the Euro (or other) dual currency symbol, determined by the current value of the NLS_DUAL_CURRENCY parameter.
V999V99Returns a value multiplied by 10(and if necessary, rounds it up), where n is the number of 9s after the V.
X
x
XXXX
xxxx
Returns the hexadecimal value of the specified number of digits. If the specified number is not an integer, then Oracle Database rounds it to an integer.

Only accepts positive values or 0. Negative values return an error. You can precede this element only with 0 (which returns leading zeroes) or FM. Any other elements return an error. If you specify neither 0 nor FM with X, then the return always has one leading blank.

How to Use Format Elements

Format elements (sometimes referred to as format specifiers) can be used to construct format models (sometimes referred to as format strings), which determine how the number is displayed.

For example:

SELECT TO_CHAR(2735.56, 'L99G999D99MI') AS Result
FROM DUAL;

Result:

          $2,735.56 

The fm format modifier can also be used to remove any padding that may have been automatically applied to the result.

Example:

SELECT TO_CHAR(2735.56, 'fmL99G999D99MI') AS Result
FROM DUAL;

Result:

$2,735.56

Datetime Format Elements

There’s a separate list of format elements for formatting datetime values.