normally we create th foreign keys like follows
SQL> create table indextest (id number,name varchar2(10));
SQL> alter table indextest add constraint id_pk primary key (id);
SQL> create table indextest1 (id number,birthdate date);
SQL> alter table indextest1 add constraint id_fk foreign key (id) references indextest(id);
but in some application i have observed the following query
SQL> ALTER TABLE indextest1 ADD CONSTRAINT id_fk FOREIGN KEY (id) REFERENCES indextest INITIALLY DEFERRED DEFERRABLE;
what is INITIALLY DEFFERED DEFERRABLE? And what it will do?
Thanks for any help
indicates that the conditions specified by the deferrable constraint are checked when the transaction is committed.
INITIALLY DEFERRED DEFERRABLE tells Oracle to do deferred constraint checking
Hope this helps u.
In addtion to what miritika wrote, this type of constraint checking is more useful when two tables are joined with foreign key relationship (parent-child) and data is entered in both at same time.
Default value of DEFERRABLE constraint is INITIALLY IMMEDIATE.
Click Here to Expand Forum to Full Width