查找受影响的行
问题描述:
如何知道有多少行受到更新查询的影响?查找受影响的行
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
我想在存储过程中使用此函数。
答
SELECT ROW_COUNT();
来源:http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_row-count
ROW_COUNT()返回的行数更改,删除或插入 上一语句,如果它是一个UPDATE,DELETE,INSERT或。对于 其他语句,该值可能没有意义。