-- 格式化金额,0.00 直接返回0
drop function FGAMT;
CREATE FUNCTION FGAMT ( amt decimal(18,2) ,jingdu int(9) )
RETURNS varchar(255)
begin
declare result varchar(255) default '';
set result = amt/jingdu;
return IF(result =0,0,FORMAT(result,2));
END;
select FGAMT(0,2)