ORA-12899: value too large for column

have a look into this blog, the problem resolved for me by changing the column datatype from varchar(100) to varchar(100 char). in my case the data contains some umlaut characters.

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


The usual reason for problems like this are non-ASCII characters that can be represented with one byte in the original database but require two (or more) bytes in the target database (due to different NLS settings).

To ensure your target column is large enough for 15 characters, you can modify it:

  ALTER TABLE table_name MODIFY column_name VARCHAR2(15 CHAR)

(note the 15 CHAR - you can also use BYTE; if neither is present, the database uses the NLS_LENGTH_SEMANTICS setting as a default).

To check which values are larger than 15 bytes, you can

  • create a staging table in the target database with the column length set to 15 CHAR
  • insert the data from the source table into the staging table
  • find the offending rows with

    SELECT * FROM staging WHERE lengthb(mycol) > 15

(note the use of LENGTHB as apposed to LENGTH - the former returns the length in bytes, whereas the latter returns the length in characters)

Tags:

Oracle