CREATE FUNCTION cleanAmount(amount DECIMAL)
RETURNS decimal(30,2)
LANGUAGE SQL
DETERMINISTIC
NO SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
DECLARE res DECIMAL;
SET res=CAST(COALESCE(amount,0.00) AS DECIMAL(30,2));
RETURN res;
END
SELECT cleanAmount('3.456');
3,00を返します。3,46になるはずです