You can do so by using below ALTER statement:
-
-
ALTER TABLE emp MODIFY name NOT NULL
-
/
-
-
Make sure there are no existing NULL values in the column name, else you will not be able to ENABLE NOT NULL constraint.
Check below:
-
-
SQL> create table my_test(col1 NUMBER);
-
-
Table created.
-
-
SQL> ed
-
Wrote file afiedt.buf
-
-
1* insert into my_test values(1)
-
SQL> /
-
-
1 row created.
-
-
SQL> ed
-
Wrote file afiedt.buf
-
-
1* insert into my_test values(NULL)
-
SQL> /
-
-
1 row created.
-
-
SQL> commit;
-
-
Commit complete.
-
-
SQL> alter table my_Test modify col1 NOT NULL;
-
alter table my_Test modify col1 NOT NULL
-
*
-
ERROR at line 1:
-
ORA-02296: cannot enable (APPS.) - null values found
-
-
-
SQL> delete from my_test WHERE col1 IS NULL;
-
-
1 row deleted.
-
-
SQL> COMMIT;
-
-
Commit complete.
-
-
SQL> alter table my_Test modify col1 NOT NULL;
-
-
Table altered.
-
-
SQL> desc my_test;
-
Name Null? Type
-
-------------- -------- ---------
-
COL1 NOT NULL NUMBER
-
-
SQL>
-
-