外观
IF语句
IF语句可以用来进行条件判断,根据条件的真假执行不同的操作。
IF语句的表示形式如下:
IF condition THEN
...
[ELSEIF condition THEN]
...
[ELSE]
...
END IF其中,condition表示判断条件。如:
delimiter //
create procedure example_if(in x int)
begin
if x=1 then select 1;
elseif x=2 then select 2;
else select 'other';
end if;
end
//