CREATE DEFINER=`root`@`localhost` FUNCTION `getMonthNumber`( mth varchar(3) ) RETURNS varchar(2) CHARSET utf8 BEGIN declare ret_str varchar(2); if mth = 'Jan' then set ret_str = '01'; elseif mth = 'Feb' then set ret_str = '02'; elseif mth = 'Mar' then set ret_str = '03'; elseif mth = 'Apr' then set ret_str = '04'; elseif mth = 'May' then set ret_str = '05'; elseif mth = 'Jun' then set ret_str = '06'; elseif mth = 'Jul' then set ret_str = '07'; elseif mth = 'Aug' then set ret_str = '08'; elseif mth = 'Sep' then set ret_str = '08'; elseif mth = 'Oct' then set ret_str = '10'; elseif mth = 'Nov' then set ret_str = '11'; elseif mth = 'Dec' then set ret_str = '12'; end if; RETURN ret_str; END