精度即数的有效数字个数

2.5的有效数字个数是2,但是053.2的有效数字个数是3

标度是小数点的位数

例如numeric(2,1),即这个数必须是两位,并且小数后面最多有一位,多出来的小数会被四舍五入

可以很容易的确定出numeric的范围,即-10(精度-标度)到10(精度-标度)次方之间,不包括两头

create table test (num numeric(2,1));
insert into test values (2.2);
 num 
-----
 2.2
insert into test values (2.26);
 num 
-----
 2.3
insert into test values (10);
ERROR:  numeric field overflow
DETAIL:  A field with precision 2, scale 1 must round to an absolute value less than 10^1.

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2021-11-25
  • 2021-07-28
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-21
  • 2021-07-12
  • 2021-07-24
  • 2021-11-13
  • 2022-12-23
相关资源
相似解决方案