Learn the purpose and how to get to the bottom of the ORA-01400 error message in Oracle.
Description
When you stumble upon an ORA-01400 error, the following error message will appear:
ORA-01400: can’t insert NULL into (“SCHEMA”.”TABLE_NAME”.”COLUMN_NAME”)
Cause
You tried to insert a NULL value into a column that does not receive NULL values.
Resolution
The option(s) to resolve this Oracle error are:
Option #1
Correct your INSERT declaration so that you do not insert a NULL price into a column that is defined as NOT NULL.
For example, if you had a table referred to as suppliers defined as follows:
CREATE TABLE suppliers
( supplier_id number not null,
supplier_name varchar2(50) not null );
And you tried to execute the following INSERT statement:
INSERT INTO suppliers
( supplier_id )
VALUES
( 10023 );
You would receive the following error message:
You have described the supplier_name column as a NOT NULL field. Yet, you have attempted to insert a NULL value into this field.
You should right this error with the following INSERT statement:
INSERT INTO suppliers
( supplier_id, supplier_name )
VALUES
( 10023, 'IBM' );
Now, you are inserting a NOT NULL fee into the supplier_name column.
Leave a Review