@@ -6277,19 +6277,19 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
6277
6277
<tbody>
6278
6278
<row>
6279
6279
<entry><literal>9</literal></entry>
6280
- <entry>value with the specified number of digits </entry>
6280
+ <entry>digit position (can be dropped if insignificant) </entry>
6281
6281
</row>
6282
6282
<row>
6283
6283
<entry><literal>0</literal></entry>
6284
- <entry>value with leading zeros </entry>
6284
+ <entry>digit position (will not be dropped, even if insignificant) </entry>
6285
6285
</row>
6286
6286
<row>
6287
6287
<entry><literal>.</literal> (period)</entry>
6288
6288
<entry>decimal point</entry>
6289
6289
</row>
6290
6290
<row>
6291
6291
<entry><literal>,</literal> (comma)</entry>
6292
- <entry>group (thousand ) separator</entry>
6292
+ <entry>group (thousands ) separator</entry>
6293
6293
</row>
6294
6294
<row>
6295
6295
<entry><literal>PR</literal></entry>
@@ -6347,25 +6347,50 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
6347
6347
Usage notes for numeric formatting:
6348
6348
6349
6349
<itemizedlist>
6350
+ <listitem>
6351
+ <para>
6352
+ <literal>0</> specifies a digit position that will always be printed,
6353
+ even if it contains a leading/trailing zero. <literal>9</> also
6354
+ specifies a digit position, but if it is a leading zero then it will
6355
+ be replaced by a space, while if it is a trailing zero and fill mode
6356
+ is specified then it will be deleted. (For <function>to_number()</>,
6357
+ these two pattern characters are equivalent.)
6358
+ </para>
6359
+ </listitem>
6360
+
6361
+ <listitem>
6362
+ <para>
6363
+ The pattern characters <literal>S</>, <literal>L</>, <literal>D</>,
6364
+ and <literal>G</> represent the sign, currency symbol, decimal point,
6365
+ and thousands separator characters defined by the current locale
6366
+ (see <xref linkend="guc-lc-monetary">
6367
+ and <xref linkend="guc-lc-numeric">). The pattern characters period
6368
+ and comma represent those exact characters, with the meanings of
6369
+ decimal point and thousands separator, regardless of locale.
6370
+ </para>
6371
+ </listitem>
6372
+
6373
+ <listitem>
6374
+ <para>
6375
+ If no explicit provision is made for a sign
6376
+ in <function>to_char()</>'s pattern, one column will be reserved for
6377
+ the sign, and it will be anchored to (appear just left of) the
6378
+ number. If <literal>S</> appears just left of some <literal>9</>'s,
6379
+ it will likewise be anchored to the number.
6380
+ </para>
6381
+ </listitem>
6382
+
6350
6383
<listitem>
6351
6384
<para>
6352
6385
A sign formatted using <literal>SG</literal>, <literal>PL</literal>, or
6353
6386
<literal>MI</literal> is not anchored to
6354
6387
the number; for example,
6355
6388
<literal>to_char(-12, 'MI9999')</literal> produces <literal>'- 12'</literal>
6356
6389
but <literal>to_char(-12, 'S9999')</literal> produces <literal>' -12'</literal>.
6357
- The Oracle implementation does not allow the use of
6390
+ ( The Oracle implementation does not allow the use of
6358
6391
<literal>MI</literal> before <literal>9</literal>, but rather
6359
6392
requires that <literal>9</literal> precede
6360
- <literal>MI</literal>.
6361
- </para>
6362
- </listitem>
6363
-
6364
- <listitem>
6365
- <para>
6366
- <literal>9</literal> results in a value with the same number of
6367
- digits as there are <literal>9</literal>s. If a digit is
6368
- not available it outputs a space.
6393
+ <literal>MI</literal>.)
6369
6394
</para>
6370
6395
</listitem>
6371
6396
@@ -6412,8 +6437,8 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
6412
6437
6413
6438
<para>
6414
6439
Certain modifiers can be applied to any template pattern to alter its
6415
- behavior. For example, <literal>FM9999 </literal>
6416
- is the <literal>9999 </literal> pattern with the
6440
+ behavior. For example, <literal>FM99.99 </literal>
6441
+ is the <literal>99.99 </literal> pattern with the
6417
6442
<literal>FM</literal> modifier.
6418
6443
<xref linkend="functions-formatting-numericmod-table"> shows the
6419
6444
modifier patterns for numeric formatting.
@@ -6432,8 +6457,8 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
6432
6457
<tbody>
6433
6458
<row>
6434
6459
<entry><literal>FM</literal> prefix</entry>
6435
- <entry>fill mode (suppress leading zeroes and padding blanks)</entry>
6436
- <entry><literal>FM9999 </literal></entry>
6460
+ <entry>fill mode (suppress trailing zeroes and padding blanks)</entry>
6461
+ <entry><literal>FM99.99 </literal></entry>
6437
6462
</row>
6438
6463
<row>
6439
6464
<entry><literal>TH</literal> suffix</entry>
@@ -6480,6 +6505,10 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
6480
6505
<entry><literal>to_char(-0.1, 'FM9.99')</literal></entry>
6481
6506
<entry><literal>'-.1'</literal></entry>
6482
6507
</row>
6508
+ <row>
6509
+ <entry><literal>to_char(-0.1, 'FM90.99')</literal></entry>
6510
+ <entry><literal>'-0.1'</literal></entry>
6511
+ </row>
6483
6512
<row>
6484
6513
<entry><literal>to_char(0.1, '0.9')</literal></entry>
6485
6514
<entry><literal>' 0.1'</literal></entry>
0 commit comments