让我们创建一个存储过程。在这里,我们正在计算数量*数量,即实现数学运算-
mysql> delimiter // mysql> create procedure calculation_proc(amount int,quantity int) begin select amount,quantity,(amount*quantity) as Total; end // mysql> delimiter ;
现在您可以使用调用命令来调用存储过程-
mysql> call calculation_proc(250,3);
这将产生以下输出-
+--------+----------+-------+ | amount | quantity | Total | +--------+----------+-------+ | 250 | 3 | 750 | +--------+----------+-------+ 1 row in set (0.00 sec)