ORA-01400: cannot insert NULL into

ORA-01400: cannot insert NULL into

Oracle PL/SQL error message: ORA-01400: cannot insert NULL into.

Cause:

An attempt was made to insert a NULL into the column with not null constraint.

Solution:

Check and change your INSERT statement, replace the NULL with an value.

Example:

CREATE TABLE employees(
	id NUMBER NOT NULL,
	name VARCHAR2(250) NOT NULL,
	dept_id NUMBER,
	salary NUMBER
);

INSERT INTO employees(id, name, dept_id, salary) VALUES (1, NULL, 20, 250);

SQL Error: ORA-01400: cannot insert NULL into

Correct insert:

INSERT INTO employees(id, name, dept_id, salary) VALUES (1, ‘Anne’, 20, 250);