Change the declare of res in the stored proc:-
CREATE FUNCTION cleanAmount(amount DECIMAL(60,30))
RETURNS decimal(30,2)
LANGUAGE SQL
DETERMINISTIC
NO SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
DECLARE res DECIMAL(30,2);
SET res=CAST(COALESCE(amount,0.00) AS DECIMAL(30,2));
RETURN res;
END