column_constraint_clause

The following is the syntax for the column_constraint_clause in the ALTER TABLE statement:

{
[NULL | NOT NULL] |
[UNIQUE | PRIMARY KEY] |
[FOREIGN KEY (column [, column ...] )]
[REFERENCES [schema.]table_name[(column)] [ON DELETE CASCADE] ]
[CHECK (condition) ]
}
[USING INDEX 
    [PCTFREE integer]
    [PCTUSED integer]
    [INITRANS integer]
    [MAXTRANS integer] 
    [TABLESPACE tablespace_name]
    [STORAGE (
        [INITIAL integer [K | M]]			
        [NEXT integer [K | M]]
        [MINEXTENTS integer [K | M]] 
        [MAXEXTENTS {integer | UNLIMITED}]
        [PCTINCREASE integer]
        [FREELISTS integer]
        [FREELIST GROUPS integer]
        )
    [NOSORT]
    [LOGGING | NOLOGGING]
]
[EXCEPTIONS INTO [schema.]table_name]
[{ENABLE [VALIDATE  | NOVALIDATE] | DISABLE} ]
[[NOT] DEFERRABLE [INITIALLY {IMMEDIATE | DEFERRED}] ]
[[INITIALLY {IMMEDIATE | DEFERRED}] [[NOT] DEFERRABLE] ]
NULL

Specifies that the values in the column list may contain NULL.

NOT NULL

Specifies that the values in the column may not contain NULL.

UNIQUE

Specifies that the column list must be unique.

PRIMARY KEY

Specifies that the column list will be a primary key. A primary key can be referenced from another table with a foreign key. A primary key must also be UNIQUE and NOT NULL.

FOREIGN KEY

Requires that all values in the column list must be either NULL or found in the referenced table’s defined primary key or the specified column list.

REFERENCES

Specifies the table that is referenced.

ON DELETE CASCADE

Specifies that any deletes to the referenced table are propagated down to this table ...

Get Oracle Database Administration: The Essential Refe now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.