SET GLOBAL log_bin_trust_function_creators = 1;
DELIMITER $$ CREATE FUNCTION pro_salary_grade( salary INT) RETURNS CHAR BEGIN DECLARE grade CHAR DEFAULT "A"; IF salary<5000 THEN SET grade ="E"; ELSEIF salary<10000 THEN SET grade ="D"; ELSEIF salary<15000 THEN SET grade ="C"; ELSEIF salary<20000 THEN SET grade ="B"; ELSE SET grade="A"; END IF; RETURN grade; END $$ DELIMITER ; SELECT pro_salary_grade(16000);