@@ -6351,19 +6351,19 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
6351
6351
<tbody>
6352
6352
<row>
6353
6353
<entry><literal>9</literal></entry>
6354
- <entry>value with the specified number of digits </entry>
6354
+ <entry>digit position (can be dropped if insignificant) </entry>
6355
6355
</row>
6356
6356
<row>
6357
6357
<entry><literal>0</literal></entry>
6358
- <entry>value with leading zeros </entry>
6358
+ <entry>digit position (will not be dropped, even if insignificant) </entry>
6359
6359
</row>
6360
6360
<row>
6361
6361
<entry><literal>.</literal> (period)</entry>
6362
6362
<entry>decimal point</entry>
6363
6363
</row>
6364
6364
<row>
6365
6365
<entry><literal>,</literal> (comma)</entry>
6366
- <entry>group (thousand ) separator</entry>
6366
+ <entry>group (thousands ) separator</entry>
6367
6367
</row>
6368
6368
<row>
6369
6369
<entry><literal>PR</literal></entry>
@@ -6421,25 +6421,50 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
6421
6421
Usage notes for numeric formatting:
6422
6422
6423
6423
<itemizedlist>
6424
+ <listitem>
6425
+ <para>
6426
+ <literal>0</> specifies a digit position that will always be printed,
6427
+ even if it contains a leading/trailing zero. <literal>9</> also
6428
+ specifies a digit position, but if it is a leading zero then it will
6429
+ be replaced by a space, while if it is a trailing zero and fill mode
6430
+ is specified then it will be deleted. (For <function>to_number()</>,
6431
+ these two pattern characters are equivalent.)
6432
+ </para>
6433
+ </listitem>
6434
+
6435
+ <listitem>
6436
+ <para>
6437
+ The pattern characters <literal>S</>, <literal>L</>, <literal>D</>,
6438
+ and <literal>G</> represent the sign, currency symbol, decimal point,
6439
+ and thousands separator characters defined by the current locale
6440
+ (see <xref linkend="guc-lc-monetary">
6441
+ and <xref linkend="guc-lc-numeric">). The pattern characters period
6442
+ and comma represent those exact characters, with the meanings of
6443
+ decimal point and thousands separator, regardless of locale.
6444
+ </para>
6445
+ </listitem>
6446
+
6447
+ <listitem>
6448
+ <para>
6449
+ If no explicit provision is made for a sign
6450
+ in <function>to_char()</>'s pattern, one column will be reserved for
6451
+ the sign, and it will be anchored to (appear just left of) the
6452
+ number. If <literal>S</> appears just left of some <literal>9</>'s,
6453
+ it will likewise be anchored to the number.
6454
+ </para>
6455
+ </listitem>
6456
+
6424
6457
<listitem>
6425
6458
<para>
6426
6459
A sign formatted using <literal>SG</literal>, <literal>PL</literal>, or
6427
6460
<literal>MI</literal> is not anchored to
6428
6461
the number; for example,
6429
6462
<literal>to_char(-12, 'MI9999')</literal> produces <literal>'- 12'</literal>
6430
6463
but <literal>to_char(-12, 'S9999')</literal> produces <literal>' -12'</literal>.
6431
- The Oracle implementation does not allow the use of
6464
+ ( The Oracle implementation does not allow the use of
6432
6465
<literal>MI</literal> before <literal>9</literal>, but rather
6433
6466
requires that <literal>9</literal> precede
6434
- <literal>MI</literal>.
6435
- </para>
6436
- </listitem>
6437
-
6438
- <listitem>
6439
- <para>
6440
- <literal>9</literal> results in a value with the same number of
6441
- digits as there are <literal>9</literal>s. If a digit is
6442
- not available it outputs a space.
6467
+ <literal>MI</literal>.)
6443
6468
</para>
6444
6469
</listitem>
6445
6470
@@ -6486,8 +6511,8 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
6486
6511
6487
6512
<para>
6488
6513
Certain modifiers can be applied to any template pattern to alter its
6489
- behavior. For example, <literal>FM9999 </literal>
6490
- is the <literal>9999 </literal> pattern with the
6514
+ behavior. For example, <literal>FM99.99 </literal>
6515
+ is the <literal>99.99 </literal> pattern with the
6491
6516
<literal>FM</literal> modifier.
6492
6517
<xref linkend="functions-formatting-numericmod-table"> shows the
6493
6518
modifier patterns for numeric formatting.
@@ -6506,8 +6531,8 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
6506
6531
<tbody>
6507
6532
<row>
6508
6533
<entry><literal>FM</literal> prefix</entry>
6509
- <entry>fill mode (suppress leading zeroes and padding blanks)</entry>
6510
- <entry><literal>FM9999 </literal></entry>
6534
+ <entry>fill mode (suppress trailing zeroes and padding blanks)</entry>
6535
+ <entry><literal>FM99.99 </literal></entry>
6511
6536
</row>
6512
6537
<row>
6513
6538
<entry><literal>TH</literal> suffix</entry>
@@ -6554,6 +6579,10 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
6554
6579
<entry><literal>to_char(-0.1, 'FM9.99')</literal></entry>
6555
6580
<entry><literal>'-.1'</literal></entry>
6556
6581
</row>
6582
+ <row>
6583
+ <entry><literal>to_char(-0.1, 'FM90.99')</literal></entry>
6584
+ <entry><literal>'-0.1'</literal></entry>
6585
+ </row>
6557
6586
<row>
6558
6587
<entry><literal>to_char(0.1, '0.9')</literal></entry>
6559
6588
<entry><literal>' 0.1'</literal></entry>
0 commit comments