813.1.8
by Jay Pipes
Fixes MONTH() function to use new Temporal system. Errors |
1 |
SELECT MONTH(NULL);
|
2 |
MONTH(NULL)
|
|
3 |
NULL
|
|
4 |
SELECT MONTH();
|
|
5 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near ')' at line 1
|
|
6 |
SELECT MONTH(1, 0);
|
|
7 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near ' 0)' at line 1
|
|
8 |
SELECT MONTH("xxx");
|
|
9 |
ERROR HY000: Received an invalid datetime value 'xxx'.
|
|
10 |
SELECT MONTH("0000-00-00");
|
|
11 |
ERROR HY000: Received an invalid datetime value '0000-00-00'.
|
|
12 |
SELECT MONTH("0000-01-01");
|
|
13 |
ERROR HY000: Received an invalid datetime value '0000-01-01'.
|
|
14 |
SELECT MONTH("0001-00-01");
|
|
15 |
ERROR HY000: Received an invalid datetime value '0001-00-01'.
|
|
16 |
SELECT MONTH("0001-01-00");
|
|
17 |
ERROR HY000: Received an invalid datetime value '0001-01-00'.
|
|
18 |
SELECT MONTH("2000-02-30");
|
|
19 |
ERROR HY000: Received an invalid datetime value '2000-02-30'.
|
|
20 |
SELECT MONTH("1900-02-29");
|
|
21 |
ERROR HY000: Received an invalid datetime value '1900-02-29'.
|
|
22 |
SELECT MONTH('1976-15-15');
|
|
23 |
ERROR HY000: Received an invalid datetime value '1976-15-15'.
|
|
24 |
SELECT MONTH("2009-01-12");
|
|
25 |
MONTH("2009-01-12")
|
|
26 |
1
|
|
27 |
SELECT MONTH("99-1-31");
|
|
28 |
MONTH("99-1-31")
|
|
29 |
1
|
|
30 |
SELECT MONTH("0001-09-30");
|
|
31 |
MONTH("0001-09-30")
|
|
32 |
9
|
|
33 |
SELECT MONTH("9999-12-31");
|
|
34 |
MONTH("9999-12-31")
|
|
35 |
12
|
|
36 |
SELECT MONTH('07/31/2009');
|
|
37 |
MONTH('07/31/2009')
|
|
38 |
7
|
|
39 |
SELECT MONTH('20090916');
|
|
40 |
MONTH('20090916')
|
|
41 |
9
|
|
42 |
SELECT MONTH('20090916091528');
|
|
43 |
MONTH('20090916091528')
|
|
44 |
9
|
|
45 |
SELECT MONTH("20090916091528.000000");
|
|
46 |
MONTH("20090916091528.000000")
|
|
47 |
9
|
|
48 |
SELECT MONTH('09-09-16');
|
|
49 |
MONTH('09-09-16')
|
|
50 |
9
|
|
51 |
SELECT MONTH('09.09.16');
|
|
52 |
MONTH('09.09.16')
|
|
53 |
9
|
|
54 |
SELECT MONTH('09/09/16');
|
|
55 |
MONTH('09/09/16')
|
|
56 |
9
|
|
57 |
SELECT MONTH('09-09-16');
|
|
58 |
MONTH('09-09-16')
|
|
59 |
9
|
|
60 |
SELECT MONTH('09-9-2');
|
|
61 |
MONTH('09-9-2')
|
|
62 |
9
|
|
63 |
SELECT MONTH(20090916);
|
|
64 |
MONTH(20090916)
|
|
65 |
9
|
|
66 |
SELECT MONTH(20090916091528);
|
|
67 |
MONTH(20090916091528)
|
|
68 |
9
|
|
813.1.19
by Jay Pipes
To remain in compatibility with MySQL, added ability to interpret |
69 |
SELECT MONTH(20090916091528.000001);
|
70 |
MONTH(20090916091528.000001)
|
|
71 |
9
|
|
813.1.8
by Jay Pipes
Fixes MONTH() function to use new Temporal system. Errors |
72 |
USE test;
|
73 |
DROP TABLE IF EXISTS t1;
|
|
74 |
CREATE TABLE t1 (
|
|
75 |
int_fld INT NOT NULL
|
|
76 |
, date_fld DATE NOT NULL
|
|
77 |
, datetime_fld DATETIME NOT NULL
|
|
78 |
, timestamp_fld TIMESTAMP NOT NULL
|
|
79 |
, char_fld CHAR(22) NOT NULL
|
|
80 |
, varchar_fld VARCHAR(22) NOT NULL
|
|
81 |
, text_fld TEXT NOT NULL
|
|
82 |
, blob_fld BLOB NOT NULL
|
|
83 |
);
|
|
84 |
INSERT INTO t1 VALUES (
|
|
85 |
20071130
|
|
86 |
, "2007-11-30"
|
|
87 |
, "2007-11-30 16:30:19"
|
|
88 |
, "2007-11-30T16:30:19"
|
|
89 |
, "2007-11-30 16:30:19"
|
|
90 |
, "2007-11-30 16:30:19"
|
|
91 |
, "2007-11-30T16:30:19"
|
|
92 |
, "2007-11-30T16:30:19"
|
|
93 |
);
|
|
94 |
SELECT MONTH(int_fld) FROM t1;
|
|
95 |
MONTH(int_fld)
|
|
96 |
11
|
|
97 |
SELECT MONTH(date_fld) FROM t1;
|
|
98 |
MONTH(date_fld)
|
|
99 |
11
|
|
100 |
SELECT MONTH(datetime_fld) FROM t1;
|
|
101 |
MONTH(datetime_fld)
|
|
102 |
11
|
|
103 |
SELECT MONTH(timestamp_fld) FROM t1;
|
|
104 |
MONTH(timestamp_fld)
|
|
105 |
11
|
|
106 |
SELECT MONTH(char_fld) FROM t1;
|
|
107 |
MONTH(char_fld)
|
|
108 |
11
|
|
109 |
SELECT MONTH(varchar_fld) FROM t1;
|
|
110 |
MONTH(varchar_fld)
|
|
111 |
11
|
|
112 |
SELECT MONTH(text_fld) FROM t1;
|
|
113 |
MONTH(text_fld)
|
|
114 |
11
|
|
115 |
SELECT MONTH(blob_fld) FROM t1;
|
|
116 |
MONTH(blob_fld)
|
|
117 |
11
|
|
118 |
DROP TABLE t1;
|