ORA-12899: value too large for column
A value is longer than the column allows. The message names the column and gives the actual and maximum length, often in bytes rather than characters.
- Error code
ORA-12899- Category
- Data values and conversion
What it means
ORA-12899 means a string doesn't fit its column, for example ORA-12899: value too large for column "SALES"."CUSTOMERS"."NAME" (actual: 61, maximum: 50). A VARCHAR2(50) column is 50 bytes by default (NLS_LENGTH_SEMANTICS = BYTE), so text with accented or non-Latin characters, which take 2 to 4 bytes each in AL32UTF8, can overflow a column that looks long enough.
Common causes
- The data is longer than the column definition.
- Multi-byte characters in a column sized in bytes.
- Migrating to a Unicode database character set, which makes some strings longer in bytes.
How to fix it
-
Find the longest values that would go into the column, and compare with its definition.
SELECT column_name, data_type, data_length, char_length, char_used FROM all_tab_columns WHERE table_name = 'CUSTOMERS' AND column_name = 'NAME';
-
Widen the column, and size it in characters if it holds text in many languages.
ALTER TABLE customers MODIFY (name VARCHAR2(200 CHAR));
-
Or truncate deliberately before inserting, if losing the tail is acceptable.
INSERT INTO customers (name) VALUES (SUBSTR(:name, 1, 50));
Related errors
ORA-01401inserted value too large for columnORA-01438value larger than specified precision8152SQL Server: String or binary data truncated2628SQL Server: Truncated in table, column22001PostgreSQL: value too long for type1406MySQL: Data too long for column
More data values and conversion errors
ORA-01722invalid numberORA-00932inconsistent datatypesORA-01476divisor is equal to zeroORA-01843not a valid monthORA-01861literal does not match format stringORA-01830date format picture ends before end of input
The code and message text are from the Oracle Database Error Help. Browse the full Oracle error list or search every database error.
Work on Oracle in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for Oracle and the other databases you use.