在MySQL中是否在存储过程中实现?
要实现if-else,语法如下-
if yourCondition then
yourStatement1;
else
yourStatement2;
end if ;要了解存储过程中if-else的上述概念,让我们创建一个存储过程-
mysql> delimiter //
mysql> create procedure If_else_stored_demo(value int)
begin
if value > 1000 then
select "your value is greater than 1000";
else
select "your value is less than or equal to 1000";
end if ;
end
//
mysql> delimiter ;现在您可以使用调用命令来调用存储过程-
mysql> call If_else_stored_demo(500);
这将产生以下输出-
+------------------------------------------+ | your value is less than or equal to 1000 | +------------------------------------------+ | your value is less than or equal to 1000 | +------------------------------------------+ 1 row in set (0.00 sec)
热门推荐
1 训练狗狗工作
4 狗狗定点排便训练
5 狗狗训练吠叫
6 狗狗尿垫训练
7 狗狗训练座
8 狗狗训练攻略
9 狗狗训练记
10 做训练狗狗
11 狗狗训练词
12 狗狗谢谢怎么训练
13 狗狗训练如厕
14 狗狗太凶怎么训练
15 狗狗训练它
16 狗狗克制训练
17 训练基地狗狗
18 怎么样训练狗狗大小硬