ORA-12899: value too large for column (actual: n, maximum: m)

ORA-12899: value too large for column "LAB_A"."CUSTOMERS"."CITY" (actual: 13, maximum: 10)

The value is longer than the column's maximum length.

Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-12

ORA-12899 tells you everything you need: the column as "SCHEMA"."TABLE"."COLUMN", the length of the value (actual) and the column limit (maximum).

The catch is the unit. VARCHAR2(10) means 10 bytes by default, not 10 characters. In an AL32UTF8 database a Korean or Japanese character takes 3 bytes, so actual can be larger than the number of characters you see.

Causes and fixes

  1. The value is simply longer than the column
  2. Korean or Japanese text: the column is sized in bytes, not characters
  3. An UPDATE adds text to an existing value

1The value is simply longer than the column

CITY is VARCHAR2(10) and San Francisco is 13 characters, so the message says (actual: 13, maximum: 10).

After widening the column with ALTER TABLE customers MODIFY city VARCHAR2(50), the same INSERT succeeds.

Setup
Setuprun as lab_a
CREATE TABLE customers (customer_id NUMBER PRIMARY KEY, city VARCHAR2(10));
OUTPUT
Table created.
Reproducerun as lab_a
INSERT INTO customers VALUES (1, 'San Francisco');
OUTPUT
INSERT INTO customers VALUES (1, 'San Francisco')
                                 *
ERROR at line 1:
ORA-12899: value too large for column "LAB_A"."CUSTOMERS"."CITY" (actual: 13, maximum: 10)
Help: https://docs.oracle.com/error-help/db/ora-12899/
Fixrun as lab_a
ALTER TABLE customers MODIFY city VARCHAR2(50);
OUTPUT
Table altered.

Widening is safe for existing rows. If the value is wrong rather than the column too small, fix the input instead.

After the fixrun as lab_a
INSERT INTO customers VALUES (1, 'San Francisco');
OUTPUT
1 row created.

2Korean or Japanese text: the column is sized in bytes, not characters

NAME is VARCHAR2(10) and the value is a 4-character Korean name. It looks like it fits, but the error says actual: 12. The database character set is AL32UTF8, and LENGTH / LENGTHB show 4 characters, 12 bytes.

VARCHAR2(10) defaulted to BYTE. Changing it to VARCHAR2(10 CHAR) lets the column hold 10 characters, and the INSERT succeeds.

The SQL builds the name with UNISTR so that the client character set cannot change the test.

Setup
Setuprun as lab_a
CREATE TABLE members (member_id NUMBER PRIMARY KEY, name VARCHAR2(10));
OUTPUT
Table created.
Reproducerun as lab_a
INSERT INTO members VALUES (1, UNISTR('\AE40\C218\D55C\AE38'));
OUTPUT
INSERT INTO members VALUES (1, UNISTR('\AE40\C218\D55C\AE38'))
                               *
ERROR at line 1:
ORA-12899: value too large for column "LAB_A"."MEMBERS"."NAME" (actual: 12, maximum: 10)
Help: https://docs.oracle.com/error-help/db/ora-12899/
Checkrun as lab_a
SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET';
SELECT LENGTH(TO_CHAR(UNISTR('\AE40\C218\D55C\AE38'))) AS chars, LENGTHB(TO_CHAR(UNISTR('\AE40\C218\D55C\AE38'))) AS bytes FROM dual;
OUTPUT
VALUE
----------------------------------------------------------------
AL32UTF8

1 row selected.


     CHARS      BYTES
---------- ----------
         4         12

1 row selected.
Fixrun as lab_a
ALTER TABLE members MODIFY name VARCHAR2(10 CHAR);
OUTPUT
Table altered.
After the fixrun as lab_a
INSERT INTO members VALUES (1, UNISTR('\AE40\C218\D55C\AE38'));
OUTPUT
1 row created.

3An UPDATE adds text to an existing value

UPDATE ... SET memo = memo || ' [CANCELLED]' makes every memo longer. The first row becomes 21 characters and the second 31, both over VARCHAR2(20). The error reports the first row that failed (actual: 21), and no row is updated.

Checking the new length first shows every row that will not fit. After widening to VARCHAR2(100), both rows are updated.

Setup
Setuprun as lab_a
CREATE TABLE orders (order_id NUMBER PRIMARY KEY, memo VARCHAR2(20));
INSERT INTO orders VALUES (1, 'Gift wrap');
INSERT INTO orders VALUES (2, 'Leave at front door');
COMMIT;
OUTPUT
Table created.


1 row created.


1 row created.


Commit complete.
Reproducerun as lab_a
UPDATE orders SET memo = memo || ' [CANCELLED]';
OUTPUT
UPDATE orders SET memo = memo || ' [CANCELLED]'
                               *
ERROR at line 1:
ORA-12899: value too large for column "LAB_A"."ORDERS"."MEMO" (actual: 21, maximum: 20)
Help: https://docs.oracle.com/error-help/db/ora-12899/
Checkrun as lab_a
SELECT order_id, LENGTH(memo || ' [CANCELLED]') AS new_len FROM orders WHERE LENGTH(memo || ' [CANCELLED]') > 20;
OUTPUT
  ORDER_ID    NEW_LEN
---------- ----------
         1         21
         2         31

2 rows selected.
Fixrun as lab_a
ALTER TABLE orders MODIFY memo VARCHAR2(100);
OUTPUT
Table altered.
After the fixrun as lab_a
UPDATE orders SET memo = memo || ' [CANCELLED]';
OUTPUT
2 rows updated.

FAQ

Why do I get ORA-12899 when the string is shorter than the column size?

The column is probably sized in bytes. In AL32UTF8 a Korean, Japanese or Chinese character is 3 bytes. Compare LENGTH and LENGTHB of the value, and consider VARCHAR2(n CHAR).

How do I find the column that causes ORA-12899?

The message names it as "SCHEMA"."TABLE"."COLUMN", and actual / maximum give the value length and the limit.

How do I check whether a column is BYTE or CHAR?

Look at CHAR_USED in USER_TAB_COLUMNS: B means bytes, C means characters.

How we verify

Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.

lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free

Related errors