Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: NOT NULL restriction and CHECK constraint on same column in 7.3.4
Ken Ho wrote:
>
> I seem to have discovered that the not null constraint is still
> required, since if I try to enter a legal value for ID but null for
> CODE, Oracle allows that, which is not my design intent. If someone
> else has added perspective on that, I look forward to reading it.
> >
> >Is there any functional or design reason to keep the CODE not null
> >restriction? The CHECK constraint prevents CODE from being null. The
> >format of the CODE data may change in the future, but if so, the CHECK
> >constraint on CODE would be updated to continue preventing CODE from
> >being null.
As you have found out, the CHECK constraint ignores NULL values so you also have to have a NOT NULL constraint.
hth,
MF Received on Tue Jun 06 2000 - 00:00:00 CDT