DELIMITER $$ CREATE DEFINER=`root`@`localhost` FUNCTION `CurrYyyymmdd`() RETURNS varchar(8) CHARSET utf8mb4 SQL SECURITY INVOKER BEGIN DECLARE ret VARCHAR(8); set ret = DATE_FORMAT(CURDATE(), "%Y%m%d"); RETURN ret; END$$ DELIMITER ;