Skip to content

How Oracle Disable NOT NULL Constraint

  • by

After you add a NOT NULL constraint to a column, you might want it stop temporarily. In such moment, you should consider to disable NOT NULL constraint.

Disable NOT NULL Constraint

To disable a NOT NULL constraint temporarily, you can do this:

SQL> alter table employees modify constraint SYS_C007818 disable;

Table altered.

It's pretty important to know that, the constraint is not vanished, it's just hided. If you try to add a NOT NULL constraint to the column, you will run into ORA-01442: column to be modified to NOT NULL is already NOT NULL.

To make the constraint function again, you can enable it.

SQL> alter table employees modify constraint SYS_C007818 enable;

Table altered.

Leave a Reply

Your email address will not be published.