Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit394af52

Browse files
committed
I'm sending patch with new version of to_char numbers formatting.
The PostgreSQL's to_char() is very compatible with Oracle's to_char now. I hope that to_char's 3000 rows of source is without bugs, but will good if anyone test it, for me it works very well :-) Karel----------------------------------------------------------------------Karel Zak <zakkr@zf.jcu.cz>http://home.zf.jcu.cz/~zakkr/
1 parent9ceb5d8 commit394af52

File tree

5 files changed

+783
-469
lines changed

5 files changed

+783
-469
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@
518518

519519
<para>
520520
<table tocentry="1">
521-
<title>Format-pictures fordatetime to_char() version.</title>
521+
<title>Format-pictures fordate/time to_char() version.</title>
522522
<tgroup cols="2">
523523
<thead>
524524
<row>
@@ -662,12 +662,12 @@
662662

663663
<para>
664664
All format-picturesallow use suffixes (postfix / prefix). The suffix is
665-
always valid for near format-picture. The 'FX' is global prefix only.
665+
always valid foranear format-picture. The 'FX' is global prefix only.
666666
</para>
667667

668668
<para>
669669
<table tocentry="1">
670-
<title>Suffixes for format-pictures fordatetime to_char() version.</title>
670+
<title>Suffixes for format-pictures fordate/time to_char() version.</title>
671671
<tgroup cols="3">
672672
<thead>
673673
<row>
@@ -695,7 +695,7 @@
695695
<row>
696696
<entry> FX </entry>
697697
<entry> FX - (Fixed format) global format-picture switch.
698-
the TO_DATETIME /TO_DATA skip blank space if this option is
698+
The TO_DATETIME /TO_DATE skip blank space if this option is
699699
not use. Must by used as first item in formt-picture. </entry>
700700
<entry> FX Month DD Day </entry>
701701
</row>
@@ -714,7 +714,7 @@
714714
</para>
715715
<para>
716716
'"' - string between a quotation marks is skipen and not is parsed.
717-
If you want write '"' to output you must use \\",exapmle '\\"YYYY Month\\"'.
717+
If you want write '"' to output you must use \\",example '\\"YYYY Month\\"'.
718718
</para>
719719
<para>
720720
text - the PostgreSQL's to_char() support text without '"', but string
@@ -776,15 +776,19 @@
776776
</row>
777777
<row>
778778
<entry> PL </entry>
779-
<entry> return plus sign on specified position (if number > 0) </entry>
779+
<entry> return plus sign on specified position (if number > 0) - PostgreSQL extension </entry>
780+
</row>
781+
<row>
782+
<entry> SG </entry>
783+
<entry> return plus/minus sign on specified position - PostgreSQL extension </entry>
780784
</row>
781785
<row>
782786
<entry> RN </entry>
783787
<entry> return number as roman number (number must be between 1 and 3999) </entry>
784788
</row>
785789
<row>
786790
<entry> TH or th </entry>
787-
<entry> convert number to ordinal number (not convert numbers under zero and decimal numbers) </entry>
791+
<entry> convert number to ordinal number (not convert numbers under zero and decimal numbers)- PostgreSQL extension</entry>
788792
</row>
789793
<row>
790794
<entry> V </entry>
@@ -801,9 +805,12 @@
801805
</para>
802806

803807
<para>
804-
The PostgreSQL to_char() not support absurd to_char(0.1, '99.99')
805-
--> <ProgramListing> ' .10' </ProgramListing> format.
806-
</para>
808+
Note: A sign formatted via 'SG', 'PL' or 'MI' is not anchor in number;
809+
to_char(-12, 'S9999') produce: <ProgramListing> ' -12' </ProgramListing>,
810+
but to_char(-12, 'MI9999') produce: <ProgramListing> '- 12' </ProgramListing>.
811+
The Oracle not allow use 'MI' ahead of '9', in the Oracle must be it always
812+
after '9'.
813+
</para>
807814

808815
<para>
809816
<table tocentry="1">
@@ -825,16 +832,24 @@
825832
<entry><ProgramListing> 'Tuesday, 05:39:18' </ProgramListing></entry>
826833
</row>
827834
<row>
828-
<entry> to_char( 0.1, '99.99') </entry>
829-
<entry><ProgramListing> ' 0.10' </ProgramListing></entry>
835+
<entry> to_char( -0.1, '99.99') </entry>
836+
<entry><ProgramListing> ' -.10' </ProgramListing></entry>
837+
</row>
838+
<row>
839+
<entry> to_char( -0.1, 'FM9.99') </entry>
840+
<entry><ProgramListing> '-.1' </ProgramListing></entry>
830841
</row>
831842
<row>
832843
<entry> to_char( 0.1, '0.9') </entry>
833844
<entry><ProgramListing> ' 0.1' </ProgramListing></entry>
834845
</row>
835846
<row>
836-
<entry> to_char( 0.1, '090.9') </entry>
837-
<entry><ProgramListing> ' 000.1' </ProgramListing></entry>
847+
<entry> to_char( 12, '9990999.9') </entry>
848+
<entry><ProgramListing> ' 0012.0' </ProgramListing></entry>
849+
</row>
850+
<row>
851+
<entry> to_char( 12, 'FM9990999.9') </entry>
852+
<entry><ProgramListing> '0012' </ProgramListing></entry>
838853
</row>
839854
<row>
840855
<entry> to_char( 485, '999') </entry>
@@ -844,18 +859,6 @@
844859
<entry> to_char( -485, '999') </entry>
845860
<entry><ProgramListing> '-485' </ProgramListing></entry>
846861
</row>
847-
<row>
848-
<entry> to_char( 485, '09999') </entry>
849-
<entry><ProgramListing> ' 00485' </ProgramListing></entry>
850-
</row>
851-
<row>
852-
<entry> to_char( 485, 'FM09999') </entry>
853-
<entry><ProgramListing> '00485' </ProgramListing></entry>
854-
</row>
855-
<row>
856-
<entry> to_char( 485, 'FM999') </entry>
857-
<entry><ProgramListing> '485' </ProgramListing></entry>
858-
</row>
859862
<row>
860863
<entry> to_char( 485, '9 9 9') </entry>
861864
<entry><ProgramListing> ' 4 8 5' </ProgramListing></entry>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp