Oct 29, 2013

Solution : 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) ;

Thanks, Cheers !!!

No comments:

Post a Comment

Translate >>