death7eater
death7eater

Reputation: 1134

Is there a difference between "not null" and "not null enable"?

When we define a table in Oracle we may define the columns as:

"NAME" VARCHAR2(80) NOT NULL ENABLE

My question is I could not understand the meaning of "ENABLE" in this statement. What would be the difference if we just define as "NAME" VARCHAR2(80) NOT NULL ?

Upvotes: 42

Views: 41873

Answers (2)

Vy Do
Vy Do

Reputation: 52636

For example (1)

CREATE TABLE FOO (PRIORITY_LEVEL NUMBER DEFAULT 42 NOT NULL ENABLE);

is the same with

CREATE TABLE FOO (PRIORITY_LEVEL NUMBER DEFAULT 42 NOT NULL);

(2)

CREATE TABLE FOO (PRIORITY_LEVEL NUMBER DEFAULT 42 NOT NULL DISABLE);

in general, is the same with

CREATE TABLE FOO (PRIORITY_LEVEL NUMBER NULL);

Upvotes: 1

Mat
Mat

Reputation: 206861

ENABLE is the default state, so leaving it out has the same effect. The opposite would be to specify DISABLE, in which case the constraint would not be active.

See the constraint documentation for more information.

Upvotes: 50

Related Questions