diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 12bbc391e0e..84826012942 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -6277,11 +6277,11 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}'); 9 - value with the specified number of digits + digit position (can be dropped if insignificant) 0 - value with leading zeros + digit position (will not be dropped, even if insignificant) . (period) @@ -6289,7 +6289,7 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}'); , (comma) - group (thousand) separator + group (thousands) separator PR @@ -6349,23 +6349,48 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}'); - A sign formatted using SG, PL, or - MI is not anchored to - the number; for example, - to_char(-12, 'MI9999') produces '-  12' - but to_char(-12, 'S9999') produces '  -12'. - The Oracle implementation does not allow the use of - MI before 9, but rather - requires that 9 precede - MI. + 0 specifies a digit position that will always be printed, + even if it contains a leading/trailing zero. 9 also + specifies a digit position, but if it is a leading zero then it will + be replaced by a space, while if it is a trailing zero and fill mode + is specified then it will be deleted. (For to_number(), + these two pattern characters are equivalent.) - 9 results in a value with the same number of - digits as there are 9s. If a digit is - not available it outputs a space. + The pattern characters S, L, D, + and G represent the sign, currency symbol, decimal point, + and thousands separator characters defined by the current locale + (see + and ). The pattern characters period + and comma represent those exact characters, with the meanings of + decimal point and thousands separator, regardless of locale. + + + + + + If no explicit provision is made for a sign + in to_char()'s pattern, one column will be reserved for + the sign, and it will be anchored to (appear just left of) the + number. If S appears just left of some 9's, + it will likewise be anchored to the number. + + + + + + A sign formatted using SG, PL, or + MI is not anchored to + the number; for example, + to_char(-12, 'MI9999') produces '-  12' + but to_char(-12, 'S9999') produces '  -12'. + (The Oracle implementation does not allow the use of + MI before 9, but rather + requires that 9 precede + MI.) @@ -6412,8 +6437,8 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}'); Certain modifiers can be applied to any template pattern to alter its - behavior. For example, FM9999 - is the 9999 pattern with the + behavior. For example, FM99.99 + is the 99.99 pattern with the FM modifier. shows the modifier patterns for numeric formatting. @@ -6432,8 +6457,8 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}'); FM prefix - fill mode (suppress leading zeroes and padding blanks) - FM9999 + fill mode (suppress trailing zeroes and padding blanks) + FM99.99 TH suffix @@ -6480,6 +6505,10 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}'); to_char(-0.1, 'FM9.99') '-.1' + + to_char(-0.1, 'FM90.99') + '-0.1' + to_char(0.1, '0.9') ' 0.1'