oracle SQL 错误:ORA-01401:插入的值对于列来说太大

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29228898/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:47:33  来源:igfitidea点击:

SQL Error: ORA-01401: inserted value too large for column

oracleoracle10g

提问by Prateek Shukla

I am getting issue while inserting a new record to the table in Oracle database. The error description says-

我在向 Oracle 数据库中的表中插入新记录时遇到问题。错误描述说-

SQL Error: ORA-01401: inserted value too large for column

SQL 错误:ORA-01401:插入的值对于列来说太大

How would I come to know that which column is having large value as I am having 60 columns in the table.

当我在表中有 60 列时,我怎么会知道哪一列具有较大的价值。

采纳答案by Lalit Kumar B

SQL Error: ORA-01401: inserted value too large for column

SQL 错误:ORA-01401:插入的值对于列来说太大

You are trying to insert value larger than the specified size for the column.

您正在尝试为列插入大于指定大小的值。

How would I come to know that which column is having large value as I am having 60 columns in the table.

当我在表中有 60 列时,我怎么会知道哪一列具有较大的价值。

The error will certainly have the table and column name with the actual size being inserted and the maximum size allowed.

错误肯定会包含表名和列名以及插入的实际大小和允许的最大大小。

For example,

例如,

SQL> CREATE TABLE t(A VARCHAR2(2));

Table created.

SQL>
SQL> INSERT INTO t VALUES ('123');
INSERT INTO t VALUES ('123')
                      *
ERROR at line 1:
ORA-12899: value too large for column "LALIT"."T"."A" (actual: 3, maximum: 2)


SQL>

In the above example, the error clearly states "column "LALIT"."T"."A" (actual: 3, maximum: 2)" where LALITis the SCHEMA, Tis the TABLEand Ais the COLUMN. The size specified for column A while table creation was 2, however, the actual insert had 3.

在上面的示例中,错误明确指出“列“ LALIT”。“T”。“A”(实际:3,最大值:2)“其中LALITSCHEMATTABLEACOLUMN。创建表时为 A 列指定的大小为 2,但实际插入时为 3。

UPDATERegarding confusion between ORA-01401and ORA-12899.

更新关于ORA-01401和之间的混淆ORA-12899

From Oracle 10g and higher, the ORA-01401was modified to ORA-12899which is more explicit and has the details about the SCHEMA, TABLE and the COLUMN which caused the error.

从 Oracle 10g 及更高版本开始,ORA-01401已修改ORA-12899为更明确的,并包含有关导致错误的 SCHEMA、TABLE 和 COLUMN 的详细信息。

Additional informationJust in case if anyone is interested:

附加信息以防万一有人感兴趣:

There is a counterpart of ORA-01401, i.e. ORA-01438which is applicable in case of NUMBER. This seems to be unchanged.

有一个对应的ORA-01401,即ORA-01438适用于 NUMBER 的情况。这似乎没有改变。

For example,

例如,

SQL> CREATE TABLE t(A number(2));

Table created.

SQL>
SQL> INSERT INTO t VALUES (123);
INSERT INTO t VALUES (123)
                      *
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column


SQL>