我的 sql (varchar2) 出错
Error in my sql (varchar2)
我在所有使用 varchar2 的表中都出现以下错误
error ORA-01438: value larger than specified precision allowed for this column
虽然我使用了小于指定长度的字符
注意:我使用的是oracle apex
根据屏幕截图,引发错误的是 DEP_ID,而不是 DEP_NAME。您似乎在 table 中错误地定义了该列。这是你所做的:
SQL> create table test (dep_id number(1, 10));
Table created.
SQL> insert into test (dep_id) values (1);
insert into test (dep_id) values (1)
*
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column
SQL> insert into test (dep_id) values (0.0000000001);
1 row created.
SQL>
换句话说,您将精度设置为“1”(即只允许一位有效数字),而比例设置为“10”(表示 "decimal" 位)。
为了您的利益,在本例中设置 DEP_ID NUMBER
,没有精度或比例。
我在所有使用 varchar2 的表中都出现以下错误
error ORA-01438: value larger than specified precision allowed for this column
虽然我使用了小于指定长度的字符
注意:我使用的是oracle apex
根据屏幕截图,引发错误的是 DEP_ID,而不是 DEP_NAME。您似乎在 table 中错误地定义了该列。这是你所做的:
SQL> create table test (dep_id number(1, 10));
Table created.
SQL> insert into test (dep_id) values (1);
insert into test (dep_id) values (1)
*
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column
SQL> insert into test (dep_id) values (0.0000000001);
1 row created.
SQL>
换句话说,您将精度设置为“1”(即只允许一位有效数字),而比例设置为“10”(表示 "decimal" 位)。
为了您的利益,在本例中设置 DEP_ID NUMBER
,没有精度或比例。