postgresql Monetary Types to BigDecimal ,error -> Bad value for type BigDecimal : 2,500.00
因为从数据库拿出来的value值带有逗号,又没有处理逗号的方法,所以会出现转型错误
解决方法:拿出来的时候强转 numeric 类型
select salary::numeric from table where id = #{id};
解决PostgreSQL数值转换错误
本文解决了在PostgreSQL中从MonetaryTypes转换到BigDecimal时出现的错误,详细介绍了如何通过将带有逗号的value值强制转换为numeric类型来避免转换错误。
postgresql Monetary Types to BigDecimal ,error -> Bad value for type BigDecimal : 2,500.00
因为从数据库拿出来的value值带有逗号,又没有处理逗号的方法,所以会出现转型错误
解决方法:拿出来的时候强转 numeric 类型
select salary::numeric from table where id = #{id};

被折叠的 条评论
为什么被折叠?