Oracle 中的数字格式问题 [英] Number format issue in Oracle

查看:77
本文介绍了Oracle 中的数字格式问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我创建了一个测试表,它有一个数据类型的数字列数字(11,8).现在,当我尝试在表中插入值 13332 时,它抛出一个 oracle 错误说:

So i have created a test table having a number column which is of the data type Number(11,8). Now when i am trying to insert the value 13332 in the table it is throwing an oracle error saying:

ORA-01438:值大于此列允许的指定精度

ORA-01438: value larger than specified precision allowed for this column

我不知道为什么.当我插入数据类型为 Number(12,6) 的列时,同样有效

I am not sure why. The same works when i am inserting into a column with data type Number(12,6)

INSERT INTO MY_TABLE(COLUMN_1)
values('13332');

推荐答案

原因是 - 在 11 位数字中,您指定了小数点后 8 位数字,因此对于整数部分(小数点前),您只能使用 3 位数字.

The reason is - out of 11 digits you have specified 8 digits after decimal places so for the whole number part (before the decimal) you are allowed only 3 digits.

假设您想在您的情况下保留 8 位小数位后,如果您将数据类型定义为 number(13,5) 这将允许整数为 5 位数字.

Assuming you want to reserve 8 digits post decimal place in your case it would work if you define the data type as number(13,5) which would allow 5 digits for the whole number.

这篇关于Oracle 中的数字格式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆