其他分享
首页 > 其他分享> > DB_COMMON_CMD

DB_COMMON_CMD

作者:互联网

-- 格式化金额,0.00 直接返回0

drop function fun_gzh_amt;

CREATE FUNCTION fun_gzh_amt ( amt decimal(18,2) ,jingdu int(9) )
RETURNS varchar(255) CHARSET utf8
BEGIN
declare result varchar(255) default '';
set result = case when convert(amt/jingdu ,decimal(18,2) ) =0.00 then '0' else convert(amt/jingdu ,decimal(18,2)) end ;
return result;
END;

select fun_gzh_amt(0.00,10000)

标签:gzh,18,0.00,CMD,DB,jingdu,result,amt,COMMON
来源: https://www.cnblogs.com/adolfmc/p/13511415.html