Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query
optimization, and usability that you won’t want to miss.
Displays errors as a result of execution of an invalid statement.
SHOW ERRORS;
SELECT @@error_count;
SHOW ERRORS
is a diagnostic statement that displays error information as a result of an invalid statement execution.@@error_count
variable displays the total number of errors.The following example shows the errors and its count after an invalid INSERT
query is run.
CREATE TABLE t1 (a TINYINT NOT NULL, B CHAR);
****
Query OK, 0 rows affected (1.25 sec)
INSERT INTO t1 VALUES(10,'mysql'), (NULL, 'test'), (300,'xyz');
****
ERROR 1048 (23000): Leaf Error (127.0.0.1:3307): Column 'a' cannot be null
SHOW ERRORS;
****
+-------+------+--------------------------------------------------------+
| Level | Code | Message |
+-------+------+--------------------------------------------------------+
| Error | 1048 | Leaf Error (127.0.0.1:3307): Column 'a' cannot be null |
+-------+------+--------------------------------------------------------+
1 row in set (0.00 sec)
SELECT @@error_count;
****
+---------------+
| @@error_count |
+---------------+
| 1 |
+---------------+
1 row in set (0.55 sec)