Learn the motive and how to resolve the ORA-01407 error message in Oracle.
Description
When you encounter an ORA-01407 error, the following error message will appear:
ORA-01407: can’t update (“SCHEMA”.”TABLE_NAME”.”COLUMN_NAME”) to NULL
Cause
You tried to update a column to a NULL fee but the column will no longer take delivery of NULL values.
Resolution
The option(s) to resolve this Oracle error are:
Option #1
Correct your UPDATE statement so that you do now not UPDATE a column with a NULL cost when the column is defined as NOT NULL.
For example, if you had a table called 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 UPDATE statement:
UPDATE suppliers
SET supplier_name = null
WHERE supplier_id = 10023;
You would receive the following error message:
You have described the supplier_name column as a NOT NULL field. Yet, you have tried to update the area with a NULL value.
You should correct this error with the following UPDATE statement:
UPDATE suppliers
SET supplier_name = 'IBM'
WHERE supplier_id = 10023;
Now, you are inserting a NOT NULL fee into the supplier_name column.
Leave a Review