trim_scale()

一个减少值精度(小数位数)的函数,通过移除尾随零来实现

trim_scale() 是一个系统函数,它通过移除尾随零来减少给定值的精度(小数位数)。

trim_scale()PostgreSQL 13 中添加。

用法

trim_scale ( numeric ) → numeric

变更历史

示例

trim_scale() 的基本执行示例

postgres=# SELECT trim_scale(1.2300);
 trim_scale
------------
       1.23
(1 row)

如果没有尾随零,trim_scale() 将不起作用

postgres=# SELECT trim_scale(1.23);
 trim_scale
------------
       1.23
(1 row)

分类

系统函数

另请参阅

scale(), min_scale(), trunc()

反馈

提交对“trim_scale()”的任何评论、建议或更正请 在此处