定义函数
CREATE DEFINER=`root`@`localhost` FUNCTION `test_fun1`(num1 FLOAT,num2 FLOAT) RETURNS float
BEGIN
DECLARE SUM FLOAT DEFAULT 0;
SET SUM=num1+num2;
RETURN SUM;
END
<select id="cunchu" resultType="java.util.Map"> SELECT test_fun1(1,2) as result </select>