Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Constraints on NULLable columns

Constraints on NULLable columns

From: Nick Kean <nick.kean_at_staff.ihug.co.nz>
Date: 21 Oct 1999 22:58:11 GMT
Message-ID: <slrn80v6k3.5rf.nick.kean@coffee.ihug.co.nz>


  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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US