MySQL存储过程声明两个值并执行数学运算
让我们首先创建一个存储过程" title="存储过程">存储过程-
mysql> delimiter //mysql> create procedure declare_demo_sp()
begin
declare Value1 int;
declare Value2 int;
set Value1=100;
set Value2=2000;
select Value1,Value2,Value1*Value2 as MultiplicationResult;
end
//
mysql> delimiter ;
使用CALL命令调用存储过程-
mysql> call declare_demo_sp();
这将产生以下输出-
+--------+--------+----------------------+| Value1 | Value2 | MultiplicationResult |
+--------+--------+----------------------+
| 100 | 2000 | 200000 |
+--------+--------+----------------------+
1 row in set (0.00 sec)
以上是 MySQL存储过程声明两个值并执行数学运算 的全部内容, 来源链接: utcz.com/z/316423.html