HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

What does enable mean in Oracle DDL constraint?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
enablewhatmeanddldoesconstraintoracle

Problem

My understanding is the different between

NOT NULL


and

NOT NULL ENABLE


is that the later will also be be applied to existing data in the table. If then you are starting from scratch is there any point in doing

NOT NULL ENABLE


Thanks

Solution

not null is a constraint. The enable that follows it is optional if you want that constraint to be active (which is the default). So

NOT NULL
NOT NULL ENABLE
NOT NULL ENABLE VALIDATE


all mean the same thing (validate is also the default, novalidate being the other option), so there really isn't an "advantage" in specifying it fully (except perhaps for documentary purposes).

If you wanted that not null constraint to be disabled, you could say:

NOT NULL DISABLE -- equivalent to NOT NULL DISABLE NOVALIDATE


or

NOT NULL DISABLE VALIDATE


See the Specifying Constraint State docs for the details and use cases on this topic.

Code Snippets

NOT NULL
NOT NULL ENABLE
NOT NULL ENABLE VALIDATE
NOT NULL DISABLE -- equivalent to NOT NULL DISABLE NOVALIDATE
NOT NULL DISABLE VALIDATE

Context

StackExchange Database Administrators Q#57123, answer score: 9

Revisions (0)

No revisions yet.