加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

哪些PostgreSQL列类型应用于存储Java BigDecimal?

发布时间:2020-12-13 16:34:24 所属栏目:百科 来源:网络整理
导读:我应该使用什么PostgreSQL列类型来存储 Java BigDecimal? 请参阅 PostgreSQL datatypes – 也许 Numeric,它可以作为任意精度类型(这是一个PostgreSQL扩展). …without any precision or scale creates a column in which numeric values of any precision a
我应该使用什么PostgreSQL列类型来存储 Java BigDecimal?
请参阅 PostgreSQL datatypes – 也许 Numeric,它可以作为任意精度类型(这是一个PostgreSQL扩展).

…without any precision or scale creates a column in which numeric values of any precision and scale can be stored,up to the implementation limit on precision.

我不完全确定“精确度的实施限制”是什么.从来没有尝试过大量的数字.如果达到极限,那么可以回到文本.但是,我怀疑在此之前会有重大的其他问题;-)如果您希望存储少一些,则将精度和/或比例指定为数字.

编辑为sjr指出,限制是精确的1000位十进制数(来自同一链接):

The type numeric can store numbers with up to 1000 digits of precision [in currentl implementations] and perform calculations exactly. It is especially recommended for storing monetary amounts and other quantities where exactness is required…

如果需要更多的精度 – 尽管手头有更大的问题 – 然后数字列将不适合(本身).但这真的是一个非常极端的“如果”,可能不会发挥限制作用.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读