How do I know how many rows were 开发者_开发百科affected by an update query?
mysql> update todel set name = 'xyz' where id = 1;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> select mysql_affected_rows();
ERROR 1305 (42000): FUNCTION test.mysql_affected_rows does not exist
I want to use this function in stored procedure.
SELECT ROW_COUNT();
From: http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_row-count
ROW_COUNT() returns the number of rows changed, deleted, or inserted by the last statement if it was an UPDATE, DELETE, or INSERT. For other statements, the value may not be meaningful.
精彩评论