-- case
-- 根据传入的月份,判定月份所属的季节(要求采用case结构)
-- 1——3月份,为第一季度
-- 4——6 月份为第二季度
-- 7——9月份为第三季度
-- 10——12月份为第四季度
create procedure p6(in month int)
begin
declare result varchar(30);
case
when month>=1 and month<=3 then
set result='为第一季度';
when month>=4 and month<=6 then
set result='为第二季度';
when month>=7 and month<=9 then
set result='为第三季度';
when month>=10 and month<=12 then
set result='为第四季度';
else
set result='非法参数';
end case ;
select concat ('您输入的月份为',month,'所属季度为',result);
end;
call p6(3)