sql报错 numeric field overflow
sql报错 numeric field overflow。precision(精度): 代表总的数值长度。scale(标度): 代表小数点后的长度。原因:该报错是由于数值类型超长引起的。
·
sql报错 numeric field overflow
原因:该报错是由于数值类型超长引起的
decimal(precision,scale)
precision(精度): 代表总的数值长度
scale(标度): 代表小数点后的长度
--建表
create table ypg_0101 (t_num decimal(10,4));
--写入11位的数据(2498000 等于 2498000.0000, 总长度是11位,超过了精度10位的限制)
insert into ypg_0101 values (2498000);
--会报错
ERROR: numeric field overflow
Detail: A field with precision 10, scale 4 must round to an absolute value less than 10^6.
Where: referenced column: t_num
Line Number: 40
--写入10位的数据
insert into ypg_0101 values (249800);
执行成功...
--修改字段长度,即可执行成功
alter table ypg_0101 modify t_num decimal(11,4);
更多推荐


所有评论(0)