@@ -5991,19 +5991,19 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
5991
5991
<tbody>
5992
5992
<row>
5993
5993
<entry><literal>9</literal></entry>
5994
- <entry>value with the specified number of digits </entry>
5994
+ <entry>digit position (can be dropped if insignificant) </entry>
5995
5995
</row>
5996
5996
<row>
5997
5997
<entry><literal>0</literal></entry>
5998
- <entry>value with leading zeros </entry>
5998
+ <entry>digit position (will not be dropped, even if insignificant) </entry>
5999
5999
</row>
6000
6000
<row>
6001
6001
<entry><literal>.</literal> (period)</entry>
6002
6002
<entry>decimal point</entry>
6003
6003
</row>
6004
6004
<row>
6005
6005
<entry><literal>,</literal> (comma)</entry>
6006
- <entry>group (thousand ) separator</entry>
6006
+ <entry>group (thousands ) separator</entry>
6007
6007
</row>
6008
6008
<row>
6009
6009
<entry><literal>PR</literal></entry>
@@ -6061,25 +6061,50 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
6061
6061
Usage notes for numeric formatting:
6062
6062
6063
6063
<itemizedlist>
6064
+ <listitem>
6065
+ <para>
6066
+ <literal>0</> specifies a digit position that will always be printed,
6067
+ even if it contains a leading/trailing zero. <literal>9</> also
6068
+ specifies a digit position, but if it is a leading zero then it will
6069
+ be replaced by a space, while if it is a trailing zero and fill mode
6070
+ is specified then it will be deleted. (For <function>to_number()</>,
6071
+ these two pattern characters are equivalent.)
6072
+ </para>
6073
+ </listitem>
6074
+
6075
+ <listitem>
6076
+ <para>
6077
+ The pattern characters <literal>S</>, <literal>L</>, <literal>D</>,
6078
+ and <literal>G</> represent the sign, currency symbol, decimal point,
6079
+ and thousands separator characters defined by the current locale
6080
+ (see <xref linkend="guc-lc-monetary">
6081
+ and <xref linkend="guc-lc-numeric">). The pattern characters period
6082
+ and comma represent those exact characters, with the meanings of
6083
+ decimal point and thousands separator, regardless of locale.
6084
+ </para>
6085
+ </listitem>
6086
+
6087
+ <listitem>
6088
+ <para>
6089
+ If no explicit provision is made for a sign
6090
+ in <function>to_char()</>'s pattern, one column will be reserved for
6091
+ the sign, and it will be anchored to (appear just left of) the
6092
+ number. If <literal>S</> appears just left of some <literal>9</>'s,
6093
+ it will likewise be anchored to the number.
6094
+ </para>
6095
+ </listitem>
6096
+
6064
6097
<listitem>
6065
6098
<para>
6066
6099
A sign formatted using <literal>SG</literal>, <literal>PL</literal>, or
6067
6100
<literal>MI</literal> is not anchored to
6068
6101
the number; for example,
6069
6102
<literal>to_char(-12, 'MI9999')</literal> produces <literal>'- 12'</literal>
6070
6103
but <literal>to_char(-12, 'S9999')</literal> produces <literal>' -12'</literal>.
6071
- The Oracle implementation does not allow the use of
6104
+ ( The Oracle implementation does not allow the use of
6072
6105
<literal>MI</literal> before <literal>9</literal>, but rather
6073
6106
requires that <literal>9</literal> precede
6074
- <literal>MI</literal>.
6075
- </para>
6076
- </listitem>
6077
-
6078
- <listitem>
6079
- <para>
6080
- <literal>9</literal> results in a value with the same number of
6081
- digits as there are <literal>9</literal>s. If a digit is
6082
- not available it outputs a space.
6107
+ <literal>MI</literal>.)
6083
6108
</para>
6084
6109
</listitem>
6085
6110
@@ -6124,8 +6149,8 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
6124
6149
6125
6150
<para>
6126
6151
Certain modifiers can be applied to any template pattern to alter its
6127
- behavior. For example, <literal>FM9999 </literal>
6128
- is the <literal>9999 </literal> pattern with the
6152
+ behavior. For example, <literal>FM99.99 </literal>
6153
+ is the <literal>99.99 </literal> pattern with the
6129
6154
<literal>FM</literal> modifier.
6130
6155
<xref linkend="functions-formatting-numericmod-table"> shows the
6131
6156
modifier patterns for numeric formatting.
@@ -6144,8 +6169,8 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
6144
6169
<tbody>
6145
6170
<row>
6146
6171
<entry><literal>FM</literal> prefix</entry>
6147
- <entry>fill mode (suppress leading zeroes and padding blanks)</entry>
6148
- <entry><literal>FM9999 </literal></entry>
6172
+ <entry>fill mode (suppress trailing zeroes and padding blanks)</entry>
6173
+ <entry><literal>FM99.99 </literal></entry>
6149
6174
</row>
6150
6175
<row>
6151
6176
<entry><literal>TH</literal> suffix</entry>
@@ -6192,6 +6217,10 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
6192
6217
<entry><literal>to_char(-0.1, 'FM9.99')</literal></entry>
6193
6218
<entry><literal>'-.1'</literal></entry>
6194
6219
</row>
6220
+ <row>
6221
+ <entry><literal>to_char(-0.1, 'FM90.99')</literal></entry>
6222
+ <entry><literal>'-0.1'</literal></entry>
6223
+ </row>
6195
6224
<row>
6196
6225
<entry><literal>to_char(0.1, '0.9')</literal></entry>
6197
6226
<entry><literal>' 0.1'</literal></entry>
0 commit comments