I have a foreign key declared like this on one of the tables:
ALTER TABLE "DBA"."INSURE" ADD CONSTRAINT "profile_key" NOT NULL FOREIGN KEY ( "COMPANY" ASC, "E_COMP" ASC ) REFERENCES "DBA"."profile" ( "company", "e_comp" ) ON UPDATE CASCADE;
does this mean that update of column company and e_comp in profile table will cascade the value to insure table or vice versa. I do not think it is the insure table that will cascade values to profile table since insure is the child table, but key is declared on the insure table so I am little confused. thanks for your help.
asked 18 Oct '12, 15:47
EDIT: I hope the following explanation is a better one: The relationship between parent and child table are as follows:
In your sample, modifying values in the columns "company" and/or "e_comp" in the profile table will lead to according modifications in th "insure" table. In constrast, deleting rows in the profile table for which rows in the insure table exist, will be prevented, as the according default action is ON DELETE RESTRICT.
To cite the docs:
One might note that the PK of a FK relationship does not need to be a PK of the according parent table, a UNIQUE KEY will do, as well.