Saturday, 7 October 2017

NOT NULL Constraint

  • NOT NULL  constraint is use to restrict the the NULL value in Database.
  • NOT NULL should be define only at column level.
  • NOT NULL constraints are the only constraints you can specify inline on XMLType and VARRAY columns.
  • Every row in the table must contain a value for the column it validated by the NOT NULL constraint

Restrictions :

  • NULL or NOT NULL can't be specify in a view constraint.
  • NULL or NOT NULL can't specify for an attribute which use a CHECK constraint with the IS [NOT] NULL condition.

Syntax :

CREATE TABLE <TABLE_NAME>
(COL_NAME1 <DATA_TYPE> (WIDTH) NOT NULL,
 COL_NAME2  <DATA_TYPE> (WIDTH) CONSTRAINT CONS_NAME NOT NULL,
 COL_NAMEn   <DATA_TYPE> (WIDTH));

See The Example:

NOT NULL CONSTRAINT EXAMPLE


No comments:

Post a Comment