0 pts.
 NULL Constraints Missing
SQL
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

Answer Wiki:
as far as i know : NOT NULL as a real constraint indicating the column can never be empty NULL is not a constraint. Using the NULL in your table definition doesn't show up NULL when you do a describe from your table. The keyword NULL is just ignored... and NULL means "it can be empty yes or no", so this includes ALL situations without any constraint.
Last Wiki Answer Submitted:  January 19, 2005  2:58 am  by  Pvandebe   0 pts.
All Answer Wiki Contributors:  Pvandebe   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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?

 0 pts.

 

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

 0 pts.

 

Because a “Null constraint” is not a constraint at all. The column may have values, or may have nulls.

 0 pts.