Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-27 · container image gvenzl/oracle-free:23-slim
ALTER TABLE ... MODIFY can make a column shorter only if every existing value still fits. If even one row is too long, Oracle refuses the change with ORA-01441 and the column keeps its old length.
Below are three common cases reproduced on a real database, with the fix we ran and its result.
01Some rows really are longer than the new length
customers.name was VARCHAR2(50) and held 'Alexander Hamilton-Smith'. ALTER TABLE customers MODIFY (name VARCHAR2(20)) failed with ORA-01441.
SELECT ... WHERE LENGTH(name) > 20 found one row: 2 Alexander Hamilton-Smith 24. After we updated it to 'Alexander Hamilton' and committed, the same MODIFY succeeded.
Setup
CREATE TABLE customers (cust_id NUMBER PRIMARY KEY, name VARCHAR2(50));
INSERT INTO customers VALUES (1, 'Kim');
INSERT INTO customers VALUES (2, 'Alexander Hamilton-Smith');
COMMIT;Table created.
1 row created.
1 row created.
Commit complete.ALTER TABLE customers MODIFY (name VARCHAR2(20));ALTER TABLE customers MODIFY (name VARCHAR2(20))
*
ERROR at line 1:
ORA-01441: cannot decrease column length because some value is too big
Help: https://docs.oracle.com/error-help/db/ora-01441/COLUMN name FORMAT A30
SELECT cust_id, name, LENGTH(name) AS len FROM customers WHERE LENGTH(name) > 20; CUST_ID NAME LEN
---------- ------------------------------ ----------
2 Alexander Hamilton-Smith 24
1 row selected.UPDATE customers SET name = 'Alexander Hamilton' WHERE cust_id = 2;
COMMIT;1 row updated.
Commit complete.Decide what to do with the long values (shorten, move elsewhere, or keep the larger column) before you change the data.
ALTER TABLE customers MODIFY (name VARCHAR2(20));Table altered.02Korean or other multibyte text: the new length is in bytes
stores.city was VARCHAR2(20 CHAR) and held a 9-character Korean value (including one space). ALTER TABLE stores MODIFY (city VARCHAR2(10)) failed with ORA-01441, even though 9 characters looks like it fits in 10.
LENGTH returned 9 but LENGTHB returned 25 bytes. Without CHAR, VARCHAR2(10) means 10 bytes. MODIFY (city VARCHAR2(10 CHAR)) succeeded, and user_tab_columns showed CHAR_LENGTH 10, CHAR_USED C.
Setup
CREATE TABLE stores (store_id NUMBER PRIMARY KEY, city VARCHAR2(20 CHAR));
INSERT INTO stores VALUES (1, UNISTR('\C11C\C6B8\D2B9\BCC4\C2DC \AC15\B0A8\AD6C'));
COMMIT;Table created.
1 row created.
Commit complete.ALTER TABLE stores MODIFY (city VARCHAR2(10));ALTER TABLE stores MODIFY (city VARCHAR2(10))
*
ERROR at line 1:
ORA-01441: cannot decrease column length because some value is too big
Help: https://docs.oracle.com/error-help/db/ora-01441/SELECT LENGTH(city) AS chars, LENGTHB(city) AS bytes FROM stores;
SELECT data_length, char_length, char_used FROM user_tab_columns WHERE table_name = 'STORES' AND column_name = 'CITY'; CHARS BYTES
---------- ----------
9 25
1 row selected.
DATA_LENGTH CHAR_LENGTH C
----------- ----------- -
80 20 C
1 row selected.Whether a bare VARCHAR2(n) means bytes or characters depends on NLS_LENGTH_SEMANTICS (BYTE by default). Writing CHAR explicitly avoids the surprise.
ALTER TABLE stores MODIFY (city VARCHAR2(10 CHAR));
SELECT char_length, char_used FROM user_tab_columns WHERE table_name = 'STORES' AND column_name = 'CITY';Table altered.
CHAR_LENGTH C
----------- -
10 C
1 row selected.03Trailing spaces make the values longer than they look
items.code held 'B-200' followed by 15 spaces. ALTER TABLE items MODIFY (code VARCHAR2(10)) failed with ORA-01441.
Wrapping the value in brackets showed [B-200 ] with LEN 20. UPDATE items SET code = RTRIM(code) WHERE code <> RTRIM(code) fixed one row, and then the MODIFY succeeded.
Setup
CREATE TABLE items (item_id NUMBER PRIMARY KEY, code VARCHAR2(30));
INSERT INTO items VALUES (1, 'A-100');
INSERT INTO items VALUES (2, 'B-200' || RPAD(' ', 15));
COMMIT;Table created.
1 row created.
1 row created.
Commit complete.ALTER TABLE items MODIFY (code VARCHAR2(10));ALTER TABLE items MODIFY (code VARCHAR2(10))
*
ERROR at line 1:
ORA-01441: cannot decrease column length because some value is too big
Help: https://docs.oracle.com/error-help/db/ora-01441/SELECT item_id, '[' || code || ']' AS code, LENGTH(code) AS len FROM items WHERE LENGTH(code) > 10; ITEM_ID CODE LEN
---------- -------------------------------- ----------
2 [B-200 ] 20
1 row selected.UPDATE items SET code = RTRIM(code) WHERE code <> RTRIM(code);
COMMIT;1 row updated.
Commit complete.This often comes from data copied out of CHAR columns or fixed-width files. Trim it when loading so it does not come back.
ALTER TABLE items MODIFY (code VARCHAR2(10));Table altered.FAQ
What does ORA-01441 mean?
You tried to shorten a column, but at least one existing value is longer than the new length. Fix or remove those values first.
How do I find the values that are too long?
Run SELECT ... WHERE LENGTH(col) > new_length. For byte limits, use LENGTHB instead of LENGTH.
Why does ORA-01441 occur when the text is shorter than the new length?
The new length may be in bytes. A 9-character value with Korean text took 25 bytes in our test. Use VARCHAR2(n CHAR) or check LENGTHB.
Can I shorten a column without losing data?
Only if every value fits. Oracle does not cut values for you; it refuses the change with ORA-01441 and leaves the column as it was.
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 23.26.3.0.0