博文背景
具体操作
delimiter $$
set global log_bin_trust_function_creators=TRUE;
create function func_fish5(mytime date)
returns varchar(25)
comment '三天打鱼两天晒网'
begin
set @yushu=(abs(DATEDIFF('2000-01-01', mytime))%5);
-- return @yushu;
if @yushu<=2 then return '打鱼';
else return '晒网';
end if;
end;
$$
delimiter ;
select func_fish5('2000-01-09');