Skip to content
Oracle Database

Oracle Error ORA-12899

value too large for column

Applies to: Oracle Database 19c, 21c, 23ai and 26ai (same wording in every release)
Last technically reviewed 24 October 2026 on Oracle Database Error Messages reference (26ai, 21c and 19c); not run locally
The full message
ORA-12899: value too large for column "SHOP"."CUSTOMERS"."CITY" (actual: 24, maximum: 20)
Other forms of this message
SQL*Plus and SQLcl show the failing line first
ERROR at line 1:
ORA-12899: value too large for column "SHOP"."CUSTOMERS"."CITY" (actual: 24, maximum: 20)
Error code
ORA-12899
Product
Oracle Database
Versions
Oracle Database 19c, 21c, 23ai and 26ai (same wording in every release)
Last reviewed
24 October 2026

What it means

ORA-12899 means an INSERT or UPDATE tried to store a string that is longer than the character column (VARCHAR2, CHAR, NVARCHAR2 or NCHAR) allows; the message names the column, the actual length and the maximum.

Each character column has a maximum length, and Oracle rejects the statement rather than cut the value. The message gives you everything you need: the column as schema, table and column, the length of the value and the limit. Oracle's reference adds the detail that matters most: the lengths are in characters if the column uses character length semantics, and otherwise in bytes.

That is why accented or non-Latin text fails sooner than you expect: in a database with a multibyte character set such as AL32UTF8, one character can take two to four bytes, so VARCHAR2(20 BYTE) may hold far fewer than 20 characters. The default is BYTE semantics (NLS_LENGTH_SEMANTICS = BYTE). The current reference also notes that when actual equals maximum, the converted value did not fit and more remained to be stored.

Common causes

  • The value is simply longer than the column: a long name, address, comment or URL.
  • The column uses BYTE semantics and the text has multibyte characters (accents, Arabic, Chinese, emoji), so its length in bytes exceeds the limit even though the character count fits.
  • Data moved from a single-byte character set database (or a column with CHAR semantics) to an AL32UTF8 one expands in bytes.
  • A load or INSERT ... SELECT maps a wide source column into a narrower target column, or concatenates values without trimming.
  • Application validation counts characters while the column counts bytes, so values pass the form and fail in the database.

Diagnose it

Read-only These queries only read the data dictionary (USER_, ALL_ and DBA_ views) and dynamic performance views (V$). They do not change data, privileges or settings, so they are safe to run first. DBA_ and V$ views need the matching privileges.

Read the column's limit and length semantics

SELECT column_name, data_type, char_length, data_length, char_used
FROM all_tab_columns
WHERE owner = 'SHOP'
  AND table_name = 'CUSTOMERS'
  AND column_name = 'CITY';
What to look for

char_used is B for BYTE semantics and C for CHAR semantics; char_length is the declared length and data_length the maximum in bytes. With B, the message lengths are bytes.

Find source values that are too long, in characters and bytes

LENGTH counts characters and LENGTHB counts bytes. Compare whichever matches the column's semantics with its limit.

SELECT customer_id, city, LENGTH(city) AS chars, LENGTHB(city) AS bytes
FROM shop.customers_staging
WHERE LENGTHB(city) > 20
ORDER BY bytes DESC;
What to look for

Rows where bytes exceeds the limit fail in a BYTE column. If chars is within the limit but bytes is not, multibyte characters are the cause and CHAR semantics would fix it.

Check the database character set and default semantics

SELECT parameter, value
FROM nls_database_parameters
WHERE parameter IN ('NLS_CHARACTERSET', 'NLS_NCHAR_CHARACTERSET', 'NLS_LENGTH_SEMANTICS');
What to look for

AL32UTF8 means characters can take up to 4 bytes in VARCHAR2 columns. NLS_LENGTH_SEMANTICS shows the default used when a column was created without BYTE or CHAR.

How to fix it

Each fix is labelled with what it changes. Try read-only checks and the least invasive fix first, and test changes outside production.

Widen the column, in characters

Changes schema

Oracle's Action text offers making the destination column wider. Declaring the length in CHAR makes the limit count characters, which is what users and applications expect. Increasing the size of a character column is always allowed, whether or not it has data.

Caution: A VARCHAR2 still cannot exceed 4000 bytes (32767 with MAX_STRING_SIZE = EXTENDED) whatever its CHAR length. Check indexes, views and code that depend on the column width before changing it.

ALTER TABLE shop.customers MODIFY (city VARCHAR2(100 CHAR));

Cut the value deliberately when a shorter one is acceptable

Changes data

The other option in Oracle's Action text is to store a subset of the source. SUBSTR counts characters; SUBSTRB counts bytes, for a BYTE column. Only truncate data that may be shortened, such as a display label, never keys or identifiers.

INSERT INTO shop.customers (customer_id, city)
SELECT customer_id, SUBSTR(city, 1, 20)
FROM shop.customers_staging;

Validate length in the application with the same unit

Client or network side

Match the form or API limit to the column: count characters for CHAR columns and bytes in the database character set for BYTE columns, and return a clear message such as "City can be at most 100 characters".

Do not set NLS_LENGTH_SEMANTICS = CHAR for the whole instance

Read-only

It can look like a global fix, but Oracle's Database Reference strongly recommends against setting it to CHAR in the instance or server parameter file, because existing installation scripts may then create columns with unexpected semantics. Use explicit CHAR in your own column definitions instead, or set it in the session that runs your DDL.

Examples

A city name longer than the column

Not reproduced here: no Oracle Database is installed for this site. The result shows the message format documented in Oracle's error reference (same in 26ai, 21c and 19c) with this example's names and lengths filled in; the table is assumed to be in schema SHOP.

CREATE TABLE customers (
    customer_id NUMBER PRIMARY KEY,
    city        VARCHAR2(20)
);

INSERT INTO customers (customer_id, city)
VALUES (1, 'Saint-Etienne-du-Rouvray');  -- 24 characters
Expected result (documented format, not run)
ORA-12899: value too large for column "SHOP"."CUSTOMERS"."CITY" (actual: 24, maximum: 20)

Multibyte text in a BYTE column

Not reproduced here: no Oracle Database is installed for this site. The message format is from Oracle's error reference; the lengths are in bytes because the column uses BYTE semantics, as the reference explains. The Cyrillic characters are written with UNISTR to keep this page plain ASCII. Declaring label VARCHAR2(10 CHAR) stores the six characters.

-- AL32UTF8 database, VARCHAR2(10 BYTE); each of these 6 characters takes 2 bytes
CREATE TABLE products (
    sku   VARCHAR2(20),
    label VARCHAR2(10 BYTE)
);

INSERT INTO products (sku, label)
VALUES ('A-100', UNISTR('\0416\0443\0440\043D\0430\043B'));
Expected result (documented format, not run)
ORA-12899: value too large for column "SHOP"."PRODUCTS"."LABEL" (actual: 12, maximum: 10)

How to prevent it

Declare character columns with explicit CHAR semantics (VARCHAR2(100 CHAR)) in databases that store multilingual text, and size them for real data rather than the shortest example. Keep application validation in the same unit as the column.

Before a load or a character set migration, compare LENGTH and LENGTHB of the source with the target limits, and decide up front whether long values should be rejected, truncated or the column widened. See SQL data types explained.

Common questions

How do I fix ORA-12899 value too large for column?

The message names the column and gives the actual and maximum lengths. Either widen the column with ALTER TABLE ... MODIFY (preferably with CHAR semantics), shorten the value deliberately with SUBSTR, or reject the row in validation.

Why is "actual" bigger than the number of characters I typed?

The column uses BYTE semantics, so lengths are counted in bytes. In an AL32UTF8 database accented and non-Latin characters take two to four bytes each. Check char_used in ALL_TAB_COLUMNS; B means bytes.

Will VARCHAR2(4000 CHAR) hold 4000 characters?

Not always. With the standard MAX_STRING_SIZE a VARCHAR2 is limited to 4000 bytes whatever the declared length, so 4000 multibyte characters do not fit. Use a CLOB for longer text, or MAX_STRING_SIZE = EXTENDED if your database is configured for it.

Learn more on CodeWithSQL

Official documentation

Last technically reviewed 24 October 2026; examples and diagnostics run on Oracle Database Error Messages reference (26ai, 21c and 19c); not run locally. Messages and explanations follow Oracle's Database Error Messages reference; no Oracle Database was available, so the examples were not run locally.

Still stuck on an Oracle error?

Browse the full Oracle error library, or get hands-on help from an experienced SQL professional.