简体   繁体   English

“not null”和“not null enable”有区别吗?

[英]Is there a difference between "not null" and "not null enable"?

When we define a table in Oracle we may define the columns as:当我们在 Oracle 中定义一个表时,我们可以将列定义为:

"NAME" VARCHAR2(80) NOT NULL ENABLE

My question is I could not understand the meaning of "ENABLE" in this statement.我的问题是我无法理解此声明中“ENABLE”的含义。 What would be the difference if we just define as "NAME" VARCHAR2(80) NOT NULL ?如果我们只定义为"NAME" VARCHAR2(80) NOT NULL什么区别?

ENABLE is the default state, so leaving it out has the same effect. ENABLE是默认状态,因此将其保留为具有相同的效果。 The opposite would be to specify DISABLE , in which case the constraint would not be active. 相反的是指定DISABLE ,在这种情况下约束不会是活动的。

See the constraint documentation for more information. 有关更多信息,请参阅约束文档。

For example (1)例如(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) (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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM