Search

DEFERRABLE CONSTRAINTS



Each constraint has two additional attributes to support deferred checking of constraints.
Ø  Deferred initially immediate
Ø  Deferred initially deferred
Deferred initially immediate checks for constraint violation at the time of insert.
Deferred initially deferred checks for constraint violation at the time of commit.

Ex:
     SQL> create table student12(no number(2), name varchar(10), marks number(3),
             constraint un unique(no) deferred initially immediate);
     SQL> create table student12(no number(2), name varchar(10), marks number(3),
             constraint un unique(no) deferred initially deferred);
     SQL> alter table student12 add constraint un unique(no) deferrable initially deferred;
   
      SQL> set constraints all immediate;
     This will enable all the constraints violations at the time of inserting.

      SQL> set constraints all deferred;
     This will enable all the constraints violations at the time of commit.