Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Composite Referential Integrity Constraint
There was a recent thread similar to this subject. Do a Google search on
"composite foreign key one field constant".
"Andrew" <andyho99_at_yahoo.com> wrote in message
news:8882aa3c.0212111350.7df40185_at_posting.google.com...
> I was wondering whether the parameter of FOREIGN KEY keyword could be
> hardcoded instead of column name. For example:
>
> change
>
> ALTER TABLE employee
> ADD CONSTRAINT fk_state_cd
> FOREIGN KEY (state_cd_grp, state_cd)
> REFERENCES master_cd(cd_grp, cd_name);
>
> to
>
> ALTER TABLE employee
> ADD CONSTRAINT fk_state_cd
> FOREIGN KEY ('ST', state_cd)
> REFERENCES master_cd(cd_grp, cd_name);
>
> In this case, I don't need state_cd_grp column in employee table. I
> tried the second sql unfortunately, it does NOT work. First sql works,
> but it will waste space if table growing very big.
>
> I think the only thing I can do to avoid state_cd_grp in employee
> table is to use trigger instead of Referential Constraint. Am I right?
> Thx.
Received on Wed Dec 11 2002 - 21:14:12 CST