ORA-12899: column value too large

I receive data from erp-systems in the form of feeds, in particular, one column length in the channel is only 15.

The column also corresponds to the target table, the length is equal varchar2(15), but when I try to load it in db, it shows an error, for example:

ORA-12899: value is too large for emp_name column (actual: 16, maximum: 15)

I can not increase the length of the column, since this is the base table in the production process.

+4
source share
4 answers

Take a look at this blog, the problem has been solved for me by changing the data type of the column from varchar (100) to varchar (100 char). in my case, the data contains umlaut characters.

http://gerardnico.com/wiki/database/oracle/byte_or_character

+5

-ASCII-, , ( ) (- NLS).

15 , :

  ALTER TABLE table_name MODIFY column_name VARCHAR2(15 CHAR)

( 15 CHAR - BYTE; , NLS_LENGTH_SEMANTICS ).

, 15 ,

  • 15 CHAR
  • * lengthb (mycol)> 15

( LENGTHB LENGTHB LENGTH - , )

+8

AL32UTF8 . UTF8 , , 99% . , . , 1 , .

, oddball. .

0

:

ORA-12899: (, )

, , , , .

ALTER TABLE TABLE_NAME ADD (NEW_COLUMN_NAME DATATYPE(DATASIZE));
UPDATE TABLE_NAME SET NEW_COLUMN_NAME  = SUBSTR(OLD_COLUMN_NAME , 1, NEW_LENGTH);
ALTER TABLE TABLE_NAME DROP COLUMN OLD_COLUMN_NAME ;
ALTER TABLE TABLE_NAME RENAME COLUMN NEW_COLUMN_NAME  TO OLD_COLUMN_NAME;

:

ALTER TABLE TABLE_NAME ADD (NEW_COLUMN_NAME DATATYPE(DATASIZE));

.

UPDATE TABLE_NAME SET NEW_COLUMN_NAME  = SUBSTR(OLD_COLUMN_NAME , 1, NEW_LENGTH);

.

ALTER TABLE TABLE_NAME DROP COLUMN OLD_COLUMN_NAME ;

, .

ALTER TABLE TABLE_NAME RENAME COLUMN NEW_COLUMN_NAME  TO OLD_COLUMN_NAME;

, .

0

Source: https://habr.com/ru/post/1654096/


All Articles