ORA-01442: column to be modified to NOT NULL is already NOT NULL

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
  • User AvatarANKUSH THAVALI
  • 02 Nov, 2021
  • 0 Comments
  • 37 Secs Read

ORA-01442: column to be modified to NOT NULL is already NOT NULL

ORA-01442: column to be modified to NOT NULL is already NOT NULL

Fix / Solution : ORA-01442: column to be modified to NOT NULL is already NOT NULL

When you fire below command, then following error will come If a column having no null values at all in a table. then you can’t add directly ‘NOT NULL’. You can follow below method to add NOT NULL constraint

sql> alter table HR.ADDRESSDETAILS modify UID not null;

ORA-01442: column to be modified to NOT NULL is already NOT NULL

Solution:

Syntax:

ALTER TABLE table_name ADD CONSTRAINT constraint_name CHECK(COLUMN_NAME IS NOT NULL);

Example:

ALTER TABLE HR.ADDRESSDETAILS  ADD CONSTRAINT nn_uid_hr_addrsdtls CHECK(UID IS NOT NULL) ;