mysql> select * from t2;
+----+------+------------+
| id | name | totalcount |
+----+------+------------+
| 1 | a | 5 | (原始值是5)
| 2 | b | 6 |
| 3 | c | 7 |
| 4 | d | 8 |
| 5 | e | 9 |
| 6 | f | 10 |
+----+------+------------+
6 rows in set (0.02 sec)
mysql>
call asd(1,'g',10);
Query OK, 2 rows affected (0.08 sec)
mysql> select * from t2;
+----+------+------------+
| id | name | totalcount |
+----+------+------------+
| 1 | a | 15 | (传递参数10+原始值5,等于15)
| 2 | b | 6 |
| 3 | c | 7 |
| 4 | d | 8 |
| 5 | e | 9 |
| 6 | f | 10 |
+----+------+------------+
6 rows in set (0.02 sec)
mysql>
call asd(1,'g',
20
);
Query OK, 2 rows affected (1.23 sec)
mysql> select * from t2;
+----+------+------------+
| id | name | totalcount |
+----+------+------------+
| 1 | a | 35 | (传递参数20+原始值15,等于35)
| 2 | b | 6 |
| 3 | c | 7 |
| 4 | d | 8 |
| 5 | e | 9 |
| 6 | f | 10 |
+----+------+------------+
6 rows in set (0.02 sec)
==============================================================================================
存储过程如下:
本文转自hcymysql51CTO博客,原文链接:http://blog.51cto.com/hcymysql/1027076 ,如需转载请自行联系原作者