Store Function
DELIMITER $$
DROP FUNCTION IF EXISTS `test1`$$
CREATE FUNCTION `test1`(
a INT,
b INT
) RETURNS varchar(30)
BEGIN
DECLARE result varchar(30) DEFAULT "none";
IF (a+b) > 10 THEN
SET result = "more than 10";
ELSE
SET result = "less than or equal 10";
END IF;
RETURN result;
END$$
DELIMITER ;
| Call function
MariaDB [test]> select test1(4,5);
+-----------------------+
| test1(4,5) |
+-----------------------+
| less than or equal 10 |
+-----------------------+
MariaDB [test]> select test1(6,5);
+--------------+
| test1(6,5) |
+--------------+
| more than 10 |
+--------------+
|