Name
SHOW WARNINGS
Synopsis
SHOW WARNINGS [LIMIT [offset,]count] SHOW COUNT(*) WARNINGS
Use this statement to display warning messages, error
messages, and notes for previous SQL statements for the current
session. This statement is available as of version 4.1 of MySQL. To
find out the number of such messages generated by the previous
statement in the session, use COUNT(*). Use the
LIMIT clause to limit the number of messages
displayed. An offset can be given along with the limit to specify a
starting point for displaying messages. Here are a couple of examples
of how you can use this statement:
INSERT INTO clients (client_name, telephone)
VALUES('Marie & Associates', '504-486-1234');
Query OK, 1 row affected, 1 warning (0.00 sec)
SHOW COUNT(*) WARNINGS;
+-------------------------+
| @@session.warning_count |
+-------------------------+
| 1 |
+-------------------------+
SHOW WARNINGS;
+---------+------+--------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------+
| Warning | 1265 | Data truncated for column 'client_name' at row 1 |
+---------+------+--------------------------------------------------+In this example, we enter the name of a client and her telephone
number in the table clients, but in the results we
see that one warning is issued. The second statement returns the
number of messages; of course, the last line of the results from the
INSERT already told us this. Notice that the results ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access