Monday, 13 February 2012

NOT NULL

    - It allows duplicate records, but doesn't allow NULL values.

    Syntax:
        column_name datatype [size] CONSTRAINT <constraint_name> NOT NULL;
   
    Examples:

    (i) Creating a NOT NULL constraint.

        Column Level NOT NULL declaration.
            create table emp
            (empno number(10), ename varchar2(20), ........... deptno number(4) CONSTRAINT notnull_deptno NOT NULL);
       
        Table Level NOT NULL decalaration.
            - Not Possible -
       
        Using Alter
            - Not Possible -
   
    (ii) Dropping a NOT NULL constraint.
       
        Alter table emp drop CONSTRAINT notnull_deptno;


No comments:

Post a Comment