oracle PLSQL: ORA-01438: 值大于此列允许的指定精度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36232565/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PLSQL: ORA-01438: value larger than specified precision allowed for this column
提问by Lay Leangsros
Please check my inserting in oracle.
请检查我在 oracle 中的插入。
SQL> desc post;
Name Null? Type
----------------------------------------- -------- --------------------
POST_BY NOT NULL NUMBER(15)
POST_NO NOT NULL NUMBER(8)
TEXT VARCHAR2(500)
LANTITUDE NUMBER(3,4)
LONGITUDE NUMBER(3,4)
NO_LIKE NUMBER(6)
POST_DATE DATE
SQL> INSERT INTO post
2 values(
3 1,
4 1,
5 'Say somthing from user ',
6 1,
7 1,
8 0,
9 sysdate
10 );
Result:
结果:
1,*
ERROR at line 6:
ORA-01438: value larger than specified precision allowed for this column
回答by Tim Biegeleisen
I believe the error is actually being caused by the way you declared the NUMBER
type for certain of your columns:
我相信错误实际上是由您NUMBER
为某些列声明类型的方式引起的:
NUMBER(3,4)
This is defining a number with a precision of 3 significant figures, with 4 of them occurring after the decimal place and -1 of them occurring before the decimal place. Read this last sentence again carefully until you see why it doesn't work for the value 1. (It would work OK if you tried to insert the value 0.002 though... up to four decimal places, and the first has to be zero.)
这是定义一个精度为 3 位有效数字的数字,其中 4 位出现在小数位后,-1 位出现在小数位前。再次仔细阅读最后一句,直到您明白为什么它对值 1 不起作用。(如果您尝试插入值 0.002 则可以正常工作...最多四位小数,第一个必须为零.)
If you want to give 4 decimal places of precision to your latitude and longitude values, then use the following defintion:
如果要为纬度和经度值提供 4 个小数位精度,请使用以下定义:
NUMBER(7, 4)
This means 3 digits before the decimal places and 4 digits after the decimal place.
这意味着小数点前 3 位和小数位后 4 位。
回答by Nikita Sindwani
This error is coming because you are using number(3,4) as its datatype.Number(3,4) means there are 3 significant digits and 4 digits after decimal.Change it.I think then it will work.
出现此错误是因为您使用 number(3,4) 作为其数据类型。Number(3,4) 表示有 3 位有效数字和 4 位小数点后的数字。更改它。我认为它会起作用。