I am working with Oracle 8i and created a simple table with three columns (two columns with NOT NULL constraints and the remaining column with a NULL constraint). I then did a select from user_constraints and only the NOT NULL constraints where returned. Any idea why the NULL constraint does not show up?
Software/Hardware used:
ASKED:
January 18, 2005 7:00 PM
UPDATED:
January 19, 2005 8:30 AM
As far as I know there is no such thing as a NULL constraint. What would be the point of creating a column on a table and then saying it must always be empty and never have a value. There is just no point in having such a column in the first place, sureley?
Hi,
This is true. I think this happens because defining a column as NULL does not impose in fact any restriction upon
the column, therefore it is not considered a constraint.
As per the documentation, you may indeed give it a
constraint name of yours, however, from the database point
of view it is not a constraint.
At the data dictionary level, the table USER_TAB_COLUMNS
still contains a NULLABLE column, which in fact stores
the column’s NULL or NOT NULL definition, and this column
already existed in the older versions of Oracle, before
the CONSTRAINT was part of the syntax at all.
Hope this could be a suggestion, if not a full explanation.
Best rgds,
Iudith Mentzel
Because a “Null constraint” is not a constraint at all. The column may have values, or may have nulls.