MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
July
Sun Mon Tue Wed Thu Fri Sat
         
23
           
2011
Months
Jul


Sat, Jul 23, 2011 9:23 pm

Show Warnings in MySQL

You can use the SHOW WARNINGS statement in MySQL to show the error, warning, and note messages that resulted from the last statement that generated messages in the current session. It shows nothing if the last statement used a table and generated no messages. (That is, a statement that uses a table but generates no messages clears the message list.) Statements that do not use tables and do not generate messages have no effect on the message list.

For example, if I issue the statement DROP TABLE IF EXISTS smf_testing statement as below, I see a notice that 0 rows were affected, but there was 1 warning. To see the warning, I can immediately afterwards issue the statement SHOW WARNINGS. I see that the warning was simply indicating that the table I asked be dropped, didn't actually exist.

mysql> DROP TABLE IF EXISTS smf_testing;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> SHOW WARNINGS;
+-------+------+-----------------------------+
| Level | Code | Message                     |
+-------+------+-----------------------------+
| Note  | 1051 | Unknown table 'smf_testing' |
+-------+------+-----------------------------+
1 row in set (0.00 sec)

mysql>

References:

  1. 12.4.5.41. SHOW WARNINGS Syntax
    MySQL :: Developer Zone

[/software/database/mysql] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo