Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Constraints on NULLable columns
Oracle7 Server Release 7.3.4.0.1 - Production
and also on
Oracle8 Enterprise Edition Release 8.0.5.1.0 - Production
SQL> create table tmp (x integer);
Table created.
SQL> alter table tmp add constraint foo check (x > 0); Table altered.
SQL> insert into tmp values (null);
1 row created.
SQL> select count(*) from tmp where x > 0; COUNT(*)
0
SQL> select count(*) from tmp;
COUNT(*)
1
Why doesn't adding the "foo" constraint to the x column stop nulls from being added? I know I could just make the column NOT NULL but shouldn't adding that constraint have the same effect?
--
Reality is a cheap substitute for Prozac
Received on Thu Oct 21 1999 - 17:58:11 CDT