Skip to content
Oracle Database

Oracle Error ORA-01400

cannot insert NULL into

Applies to: Oracle Database 19c, 21c, 23ai and 26ai (same wording)
Last technically reviewed 24 October 2026 on Oracle Database Error Messages reference (26ai, 21c and 19c); not run locally
The full message
ORA-01400: cannot insert NULL into ("SHOP"."CUSTOMERS"."EMAIL")
Other forms of this message
SQL*Plus and SQLcl show the failing line first
ERROR at line 1:
ORA-01400: cannot insert NULL into ("SHOP"."CUSTOMERS"."EMAIL")
A primary key or identity column (always NOT NULL)
ORA-01400: cannot insert NULL into ("SHOP"."CUSTOMERS"."ID")
Error code
ORA-01400
Product
Oracle Database
Versions
Oracle Database 19c, 21c, 23ai and 26ai (same wording)
Last reviewed
24 October 2026

What it means

ORA-01400 means an INSERT (or the insert branch of a MERGE) would store NULL in a column that does not accept NULL, so Oracle rejected the statement. The message names the schema, table and column.

A column declared NOT NULL, and every primary key and identity column, must hold a value in every row. When an INSERT supplies NULL for such a column, either explicitly or by leaving the column out when it has no default, Oracle rolls back the statement and raises ORA-01400. Unlike many constraint errors, the message names the exact column as "SCHEMA"."TABLE"."COLUMN", so you know at once where to look.

A NULL is not the same as a missing column. A column default is used only when the INSERT leaves the column out; if the statement names the column and passes NULL (for example from an empty application field or a NULL in a source table), the default is skipped and the NOT NULL rule fires. Oracle's DEFAULT ... ON NULL clause exists for exactly that case. Setting an existing value to NULL with UPDATE raises a different error, ORA-01407. Oracle's current reference also notes that reservable columns (used for lock-free reservations) cannot accept NULL values.

Common causes

  • The INSERT leaves out a NOT NULL column that has no default, so Oracle fills it with NULL.
  • The application binds NULL for a required field, such as an empty form value or a missing JSON property.
  • An INSERT ... SELECT or a load reads NULLs from the source for a column that is NOT NULL in the target.
  • NULL is passed explicitly to a column with a plain DEFAULT, which only applies when the column is omitted.
  • NULL is passed to a GENERATED BY DEFAULT identity column (without ON NULL), or the key column is left empty when no sequence or identity fills it.

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.

Which columns are NOT NULL, and which have defaults?

Use the schema, table and column from the message. NULLABLE = N means the column needs a value; DATA_DEFAULT and DEFAULT_ON_NULL show whether Oracle can fill it for you.

SELECT column_name, nullable, data_default, default_on_null, identity_column
FROM all_tab_columns
WHERE owner = 'SHOP'
  AND table_name = 'CUSTOMERS'
ORDER BY column_id;
What to look for

One row per column. A column with NULLABLE = N and no default must be given a value in every INSERT.

Find the source rows that would fail

SELECT *
FROM shop.customers_staging
WHERE email IS NULL;
What to look for

Each row returned would raise ORA-01400 if loaded into the NOT NULL column as it is.

Is a trigger changing the value?

A BEFORE INSERT trigger can set a column to NULL, or be expected to fill it and be disabled. List the triggers on the table and read the ones that fire on INSERT.

SELECT trigger_name, trigger_type, triggering_event, status
FROM all_triggers
WHERE table_owner = 'SHOP'
  AND table_name = 'CUSTOMERS';
What to look for

No rows means no trigger is involved. A DISABLED trigger that should fill the column explains NULLs that used to be filled in.

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.

Supply the value in the INSERT

Changes data

The usual fix: name every required column and give it a value. Validate required fields in the application before the statement is sent, so the user gets a clear message instead of a database error.

INSERT INTO shop.customers (email, name)
VALUES ('sara@example.com', 'Sara Ahmed');

Replace or skip NULLs when loading from another table

Changes data

Decide what a missing value should mean. Either substitute a real value with NVL or COALESCE, or leave those rows out and review them separately. Do not invent placeholder values that look like real data.

INSERT INTO shop.customers (email, name)
SELECT s.email, NVL(s.name, 'Unknown')
FROM shop.customers_staging s
WHERE s.email IS NOT NULL;

Let Oracle fill the column when NULL is passed (DEFAULT ON NULL)

Changes schema

When a column has a sensible default and callers may pass NULL explicitly, DEFAULT ... ON NULL makes Oracle use the default for an INSERT that assigns NULL. For an identity column, GENERATED BY DEFAULT ON NULL does the same with the sequence value.

Caution: Only do this where the default really is the right value; otherwise you hide missing data. Change the table when nothing else is altering it, and test on a copy first.

ALTER TABLE shop.customers
  MODIFY status DEFAULT ON NULL 'ACTIVE';

ALTER TABLE shop.customers
  MODIFY id GENERATED BY DEFAULT ON NULL AS IDENTITY;

Do not drop the NOT NULL constraint to make the error go away

Read-only

Making the column nullable lets incomplete rows in, and every report or join that assumes a value then has to cope with NULL. Relax the rule only if the business really allows the value to be unknown.

Examples

Leaving out a required column

Not reproduced here: no Oracle Database is installed for this site. The result shows the message format documented in Oracle's error reference, with the column given as schema, table and column; the schema name SHOP is illustrative. The wording is the same in 19c and current releases.

CREATE TABLE customers (
    id    NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    email VARCHAR2(200) NOT NULL,
    name  VARCHAR2(100)
);

INSERT INTO customers (name) VALUES ('Sara');
Expected result (documented format, not run)
ORA-01400: cannot insert NULL into ("SHOP"."CUSTOMERS"."EMAIL")

Passing NULL to a column that has a plain DEFAULT

Not reproduced here: no Oracle Database is installed for this site. The behaviour follows Oracle's SQL Language Reference (a plain DEFAULT applies when the column is omitted; DEFAULT ON NULL also covers an explicit NULL), and the message format comes from Oracle's error reference. The schema name is illustrative.

CREATE TABLE orders (
    id     NUMBER PRIMARY KEY,
    status VARCHAR2(20) DEFAULT 'NEW' NOT NULL
);

-- the default is used here, because status is left out
INSERT INTO orders (id) VALUES (1);

-- but not here: the statement assigns NULL explicitly
INSERT INTO orders (id, status) VALUES (2, NULL);
Expected result (documented format, not run)
ORA-01400: cannot insert NULL into ("SHOP"."ORDERS"."STATUS")

How to prevent it

Mark every required field as NOT NULL and keep the rule in the table, then check the same fields in the application so users see a friendly message. Name all target columns in INSERT statements instead of relying on column order.

Before loading data, count the NULLs in each column that is required in the target and decide how to handle them. Where callers routinely pass NULL for "use the default", declare the column with DEFAULT ON NULL rather than repeating the default in every program.

Common questions

How do I fix ORA-01400 cannot insert NULL into?

Read the column named in the message, then give it a value in the INSERT, filter or replace the NULL rows in the source, or declare a DEFAULT ON NULL if a default is genuinely correct.

Why do I get ORA-01400 when the column has a default?

A plain DEFAULT is used only when the INSERT leaves the column out. If the statement names the column and passes NULL, the default is skipped. Leave the column out, pass a value, or use DEFAULT ON NULL.

Is ORA-01400 the same as ORA-01407?

They enforce the same NOT NULL rule. ORA-01400 is raised when an INSERT would store NULL; ORA-01407 is raised when an UPDATE would change an existing value to NULL.

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.