Thanks for the question, raj.
Asked: January 09, 2019 - 5:46 pm UTC
Last updated: January 10, 2019 - 7:12 am UTC
Version: oracle 12 standard
Viewed 1000+ times
SQL> create table t ( c1 int, c2 int ); Table created. SQL> insert into t values (1,1); 1 row created. SQL> insert into t values (1,null); 1 row created. SQL> insert into t values (null,1); 1 row created. SQL> insert into t values (null,null); 1 row created. SQL> SQL> alter table t 2 add constraint CHK check ( not ( c1 is null and c2 is null ) ) 3 enable novalidate; Table altered. SQL> SQL> delete from t where c1 is null and c2 is null; 1 row deleted. SQL> SQL> alter table t 2 modify constraint CHK 3 enable validate; Table altered. SQL> SQL> insert into t values (null,null); insert into t values (null,null) * ERROR at line 1: ORA-02290: check constraint (MCDONAC.CHK) violated
New to good database design? Check out Chris Saxon's full fundamentals class.