@@ -5775,19 +5775,19 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
5775
5775
<tbody>
5776
5776
<row>
5777
5777
<entry><literal>9</literal></entry>
5778
- <entry>value with the specified number of digits </entry>
5778
+ <entry>digit position (can be dropped if insignificant) </entry>
5779
5779
</row>
5780
5780
<row>
5781
5781
<entry><literal>0</literal></entry>
5782
- <entry>value with leading zeros </entry>
5782
+ <entry>digit position (will not be dropped, even if insignificant) </entry>
5783
5783
</row>
5784
5784
<row>
5785
5785
<entry><literal>.</literal> (period)</entry>
5786
5786
<entry>decimal point</entry>
5787
5787
</row>
5788
5788
<row>
5789
5789
<entry><literal>,</literal> (comma)</entry>
5790
- <entry>group (thousand ) separator</entry>
5790
+ <entry>group (thousands ) separator</entry>
5791
5791
</row>
5792
5792
<row>
5793
5793
<entry><literal>PR</literal></entry>
@@ -5845,25 +5845,50 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
5845
5845
Usage notes for numeric formatting:
5846
5846
5847
5847
<itemizedlist>
5848
+ <listitem>
5849
+ <para>
5850
+ <literal>0</> specifies a digit position that will always be printed,
5851
+ even if it contains a leading/trailing zero. <literal>9</> also
5852
+ specifies a digit position, but if it is a leading zero then it will
5853
+ be replaced by a space, while if it is a trailing zero and fill mode
5854
+ is specified then it will be deleted. (For <function>to_number()</>,
5855
+ these two pattern characters are equivalent.)
5856
+ </para>
5857
+ </listitem>
5858
+
5859
+ <listitem>
5860
+ <para>
5861
+ The pattern characters <literal>S</>, <literal>L</>, <literal>D</>,
5862
+ and <literal>G</> represent the sign, currency symbol, decimal point,
5863
+ and thousands separator characters defined by the current locale
5864
+ (see <xref linkend="guc-lc-monetary">
5865
+ and <xref linkend="guc-lc-numeric">). The pattern characters period
5866
+ and comma represent those exact characters, with the meanings of
5867
+ decimal point and thousands separator, regardless of locale.
5868
+ </para>
5869
+ </listitem>
5870
+
5871
+ <listitem>
5872
+ <para>
5873
+ If no explicit provision is made for a sign
5874
+ in <function>to_char()</>'s pattern, one column will be reserved for
5875
+ the sign, and it will be anchored to (appear just left of) the
5876
+ number. If <literal>S</> appears just left of some <literal>9</>'s,
5877
+ it will likewise be anchored to the number.
5878
+ </para>
5879
+ </listitem>
5880
+
5848
5881
<listitem>
5849
5882
<para>
5850
5883
A sign formatted using <literal>SG</literal>, <literal>PL</literal>, or
5851
5884
<literal>MI</literal> is not anchored to
5852
5885
the number; for example,
5853
5886
<literal>to_char(-12, 'MI9999')</literal> produces <literal>'- 12'</literal>
5854
5887
but <literal>to_char(-12, 'S9999')</literal> produces <literal>' -12'</literal>.
5855
- The Oracle implementation does not allow the use of
5888
+ ( The Oracle implementation does not allow the use of
5856
5889
<literal>MI</literal> before <literal>9</literal>, but rather
5857
5890
requires that <literal>9</literal> precede
5858
- <literal>MI</literal>.
5859
- </para>
5860
- </listitem>
5861
-
5862
- <listitem>
5863
- <para>
5864
- <literal>9</literal> results in a value with the same number of
5865
- digits as there are <literal>9</literal>s. If a digit is
5866
- not available it outputs a space.
5891
+ <literal>MI</literal>.)
5867
5892
</para>
5868
5893
</listitem>
5869
5894
@@ -5908,8 +5933,8 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
5908
5933
5909
5934
<para>
5910
5935
Certain modifiers can be applied to any template pattern to alter its
5911
- behavior. For example, <literal>FM9999 </literal>
5912
- is the <literal>9999 </literal> pattern with the
5936
+ behavior. For example, <literal>FM99.99 </literal>
5937
+ is the <literal>99.99 </literal> pattern with the
5913
5938
<literal>FM</literal> modifier.
5914
5939
<xref linkend="functions-formatting-numericmod-table"> shows the
5915
5940
modifier patterns for numeric formatting.
@@ -5928,8 +5953,8 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
5928
5953
<tbody>
5929
5954
<row>
5930
5955
<entry><literal>FM</literal> prefix</entry>
5931
- <entry>fill mode (suppress leading zeroes and padding blanks)</entry>
5932
- <entry><literal>FM9999 </literal></entry>
5956
+ <entry>fill mode (suppress trailing zeroes and padding blanks)</entry>
5957
+ <entry><literal>FM99.99 </literal></entry>
5933
5958
</row>
5934
5959
<row>
5935
5960
<entry><literal>TH</literal> suffix</entry>
@@ -5976,6 +6001,10 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
5976
6001
<entry><literal>to_char(-0.1, 'FM9.99')</literal></entry>
5977
6002
<entry><literal>'-.1'</literal></entry>
5978
6003
</row>
6004
+ <row>
6005
+ <entry><literal>to_char(-0.1, 'FM90.99')</literal></entry>
6006
+ <entry><literal>'-0.1'</literal></entry>
6007
+ </row>
5979
6008
<row>
5980
6009
<entry><literal>to_char(0.1, '0.9')</literal></entry>
5981
6010
<entry><literal>' 0.1'</literal></entry>
0 commit comments