本文章主若是对Oracle to_char 的用法的描述,相对而言Oracle to_char能在很短的时刻里被普遍的应用,声名它的可现实应用性仍是占优势的,以下就是文章的具体内容的介绍,但愿你会有所收成。 1.The following are number examples for the to_char function.
2 D: n/ Z" |& z 2.to_char(1210.73, '9999.9') would return '1210.7'
# _; g& b" }: {+ F3 R/ H3 D 3.to_char(1210.73, '9,999.99') would return '1,210.73'7 i' C) W1 ~$ k1 Z0 f5 W2 Q
4.to_char(1210.73, '$9,999.00') would return '$1,210.73'
. _0 n& N- m+ S3 Q, q- [ 5.to_char(21, '000099') would return '000021'
* g7 E$ F7 X8 O+ y) Y5 p1 i 6.The following is a list of valid parameters when6 a% H( d3 P- D0 u" ~9 L
the to_char function is used to convert a date to a string.
7 G3 |5 A5 C, p+ E. d These parameters can be used in many combinations.+ u4 B ]0 N- |0 d2 J% }0 \& h. O0 |
7.Parameter Explanation! D; M* [& C) B3 ]9 `1 C
8.YEAR Year, spelled out
5 O( u, {9 q5 [8 @ 9.YYYY 4-digit year
7 {# m% n. E l' z. M8 I3 Y" T 10.YYY n- }( `% L8 B( \
11.YY2 w0 F4 x' U3 F6 R3 l
12.Y Last 3, 2, or 1 digit(s) of year.4 k) C0 z: W6 w7 }4 f+ F
13.IYY! Q- w; x4 S [' X8 y$ \6 O4 f8 l
14.IY
1 J5 ~% p" z3 Y/ t" o) |6 ^ 15.I Last 3, 2, or 1 digit(s) of ISO year.
1 |1 y; d8 B) q+ n, H S, W0 ~! a 16.IYYY 4-digit year based on the ISO standard
2 A( H B/ s/ H0 L 17.Q Quarter of year (1, 2, 3, 4; JAN-MAR = 1).0 m% J D5 K4 {- \8 E8 J( @' Q# f
18.MM Month (01-12; JAN = 01).
- A$ o" A2 _- q) x 19.MON Abbreviated name of month.
$ b4 e8 L# w* |: \, [ 20.MONTH Name of month, padded with blanks to length of 9 characters.
# O0 @1 s* [, U 21.RM Roman numeral month (I-XII; JAN = I).
3 i [8 O" Q3 A9 z 22.WW Week of year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year.% y) x' z/ b0 J+ d- |: P
23.W Week of month (1-5) where week 1 starts on the first day of the month and ends on the seventh.
/ X1 x3 T+ J; f& N+ _( m" V. U 24.IW Week of year (1-52 or 1-53) based on the ISO standard.
3 t8 _) |4 N' ?1 A0 g% s( _, b 25.D Day of week (1-7).8 E& o( [! G7 n7 S# G% \
26.DAY Name of day.. m9 [+ Q9 w" R) a+ n) |7 j
27.DD Day of month (1-31).7 \: @8 p$ J8 q
28.DDD Day of year (1-366).9 E# n2 n8 G& r1 P; Z4 R- v7 |
29.DY Abbreviated name of day.
9 Q7 K \ l# ~/ u+ P 30.J Julian day; the number of days since January 1, 4712 BC. |