-
Hi ,
normally we create th foreign keys like follows
SQL> create table indextest (id number,name varchar2(10));
Table created.
SQL> alter table indextest add constraint id_pk primary key (id);
Table altered.
SQL> create table indextest1 (id number,birthdate date);
Table created.
SQL> alter table indextest1 add constraint id_fk foreign key (id) references indextest(id);
Table altered.
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
SrinivasM
-
DEFERRED
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.
gtm