ad

NOT NULL Constraint

Exceptions:
Ø  NOT NULL constraint is supported for an attribute whose data type is USER_DEFINED object, VARRAY, REF, LOB.
Ø  NOT NULL, FOREIGN KEY, and REF constraints are supported on a column of type REF.
Ø  NOT NULL Constraint:
Ø  A NOT NULL constraint prohibits a column from containing NULL values.
Ø  NOT NULL should be defined only at column level.
Ø  The default constraint if not specified is NULL constraint.
Ø  To satisfy the rule, every row in the table must contain a value for the column.
Restrictions:
Ø  NULL or NOT NULL cannot be specified as view constraints.
Ø  NULL or NOT NULL cannot be specified for an attribute of an object.
Syntax:
·         Create Table <table_name>
                        (
                        Column_name1 <data type>(width) NOT NULL,
                        Column_name2<data type>(width)
                        Contraint consname NOT NULL,
                        Column_nameN <data type>(width)
            );
Illustration:
·         Create Table Students
                        (
                                    Studno number(6)
                                    CONSTRAINT StudnoNN NOT NULL,
                                    StudName varchar2(25)
                                    CONSTRAINT StudNameNN NOT NULL,
                                    CourseName varchar2(25)
                                    CONSTRAINT CourseNameNN NOT NULL,
                                    JoinDate Date NOT NULL

                        );