Tuesday, September 3, 2019

ORA-12899: value too large for column...

You may want to learn about a similar error message ORA-01438 caused by larger values being inserted in NUMBER columns. 
Message displayed with error ORA-12899 is self-explained. This error would come if you are trying to insert into a table’s column which is not big enough to hold the data being inserted. Suppose you define a column with a width of 10 characters (VARCHAR2(10)), and later if you try to insert a value longer than 10 characters, ORA-12899 would be returned. To solve this problem you can either reduce the data width being inserted, or alternatively increase the column width. If you have a multi-byte database characterset,  a VARCHAR2 column with a width of 10 may not store exactly 10 characters. Following is one example to produce ORA-12899.

SQL> drop table test;

Table dropped.

SQL> create table test(name varchar2(4));

Table created.

SQL> insert into test values ('aaaaaaaaa');
insert into test values ('aaaaaaaaa')
                         *
ERROR at line 1:
ORA-12899: value too large for column "SYS"."TEST"."NAME" (actual: 9, maximum:4


SQL> insert into test values ('aaaa');

1 row created.



No comments:

Post a Comment

Popular Posts - All Times