Details
Description
Include a warning message for zero-value date when reading data from a table using date and time functions
12.1.2>CREATE OR REPLACE TABLE t1 (a DATE, b DATE); |
Query OK, 0 rows affected (0.103 sec) |
|
12.1.2>
|
12.1.2>INSERT INTO t1 VALUES ("2003-12-15", "0000-00-00"); |
Query OK, 1 row affected (0.008 sec)
|
|
12.1.2>
|
12.1.2>SELECT DATEDIFF(a,b) FROM t1; |
+---------------+ |
| DATEDIFF(a,b) |
|
+---------------+ |
| NULL | |
+---------------+ |
1 row in set (0.000 sec) |
|
12.1.2>
|
Server shows warning message for zero-value date when using date and time functions directly
12.1.2>SELECT DATEDIFF("2003-12-15", "0000-00-00"); |
+--------------------------------------+ |
| DATEDIFF("2003-12-15", "0000-00-00") | |
+--------------------------------------+ |
| NULL | |
+--------------------------------------+ |
1 row in set, 1 warning (0.000 sec) |
|
12.1.2>SHOW WARNINGS;
|
+---------+------+----------------------------------------+ |
| Level | Code | Message | |
+---------+------+----------------------------------------+ |
| Warning | 1292 | Incorrect datetime value: '0000-00-00' | |
+---------+------+----------------------------------------+ |
1 row in set (0.000 sec) |
|
12.1.2>
|