SHOW ERRORS

Displays errors as a result of execution of an invalid statement.

Syntax

SHOW ERRORS;
SELECT @@error_count;

Remarks

  • 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.

  • See the Permission Matrix for the required permission.

Examples

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)

Last modified: January 11, 2023

Was this article helpful?