mysql存储过程中的if语句测试(包含赋值语句和null判断)

BEGIN
declare tmp0 INT;
set tmp0=3;
if tmp0=3 THEN
set tmp0=5;
end if; #注意这个end if是不能少的

set tmp0=null;

if tmp0 is null THEN
set tmp0=7;
end if; #注意这个end if是不能少的

select tmp0;
END

posted on 2019-05-24 09:53  停在夯格瑞停在服了许  阅读(3469)  评论(0编辑  收藏  举报

导航