Numeric format strings - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Numeric format strings

Following, you can find a reference for numeric format strings.

The following format strings apply to functions such as TO_NUMBER and TO_CHAR.

  • For examples of formatting strings as numbers, see TO_NUMBER.

  • For examples of formatting numbers as strings, see TO_CHAR.

Format Description
9 Numeric value with the specified number of digits.
0 Numeric value with leading zeros.
. (period), D Decimal point.
, (comma) Thousands separator.
CC Century code. For example, the 21st century started on 2001-01-01 (supported for TO_CHAR only).
FM Fill mode. Suppress padding blanks and zeroes.
PR Negative value in angle brackets.
S Sign anchored to a number.
L Currency symbol in the specified position.
G Group separator.
MI Minus sign in the specified position for numbers that are less than 0.
PL Plus sign in the specified position for numbers that are greater than 0.
SG Plus or minus sign in the specified position.
RN Roman numeral between 1 and 3999 (supported for TO_CHAR only).
TH or th Ordinal number suffix. Does not convert fractional numbers or values that are less than zero.