开发者

Finding affected rows

开发者 https://www.devze.com 2023-04-06 20:13 出处:网络
How do I know how many rows were 开发者_开发百科affected by an update query? mysql> update todel set name = \'xyz\' where id = 1;

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消