how to check for not null column constraint in oracle sql?
16,611
SELECT nullable
FROM all_tab_cols
WHERE owner = <<owner of table>>
AND table_name = <<name of table>>
AND column_name = <<name of column>>
will work assuming the column is marked NOT NULL rather than, say, having a CHECK
constraint that checks that it is non-NULL.
Author by
serpiente
Updated on July 12, 2022Comments
-
serpiente almost 2 years
How do i check if a column in a table has a not null constraint in an oracle db? Can it be checked with the data dictionary?
-
APC about 12 yearsPeople who use check constraints rather than column DDL to define not null columo.ns should be severely spoken to.
-
Dan Lenski over 7 years@APC, agreed, but internally Oracle represents those
NOT NULL
columns with check constraints. They're utterly indistinguishable fromALL_CONSTRAINTS
. RRgghgh. >:-(