mysql 存储过程可以不可以写第三个参数
1个回答
展开全部
mysql> DELIMITER //
mysql> CREATE PROCEDURE HelloWorld2(
-> IN vUserName VARCHAR(10),
-> OUT vOutValue VARCHAR(10),
-> INOUT vInOutValue VARCHAR(10))
-> BEGIN
-> SELECT CONCAT('Hello ', vUserName);
-> SET vOutValue = 'A';
-> SET vInOutValue = 'B';
-> END//
Query OK, 0 rows affected (0.00 sec)
mysql> call HelloWorld2('Edward', @a, @b)//
+-----------------------------+
| CONCAT('Hello ', vUserName) |
+-----------------------------+
| Hello Edward |
+-----------------------------+
1 row in set (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
mysql> select @a//
+------+
| @a |
+------+
| A |
+------+
1 row in set (0.00 sec)
mysql> select @b//
+------+
| @b |
+------+
| B |
+------+
1 row in set (0.00 sec)
mysql> CREATE PROCEDURE HelloWorld2(
-> IN vUserName VARCHAR(10),
-> OUT vOutValue VARCHAR(10),
-> INOUT vInOutValue VARCHAR(10))
-> BEGIN
-> SELECT CONCAT('Hello ', vUserName);
-> SET vOutValue = 'A';
-> SET vInOutValue = 'B';
-> END//
Query OK, 0 rows affected (0.00 sec)
mysql> call HelloWorld2('Edward', @a, @b)//
+-----------------------------+
| CONCAT('Hello ', vUserName) |
+-----------------------------+
| Hello Edward |
+-----------------------------+
1 row in set (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
mysql> select @a//
+------+
| @a |
+------+
| A |
+------+
1 row in set (0.00 sec)
mysql> select @b//
+------+
| @b |
+------+
| B |
+------+
1 row in set (0.00 sec)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询