Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: FK and NULL values
Peter Aku wrote:
> FK1 is a foreign key defined on table B. FK1 is composed
> of more than one column.
>
> If NULLs are allowed on those columns (FK1) in table B,
> when a row which contains NULLs on any of the columns that
> compose FK1, ORACLE allows these NULLs to be inserted,
> as expected. However, no validation is performed on the
> foreign key constraint. Inconsistent values may be
> introduced through this kind of addition or update
> exercise.
Hello Ana!
Lets say you have three tables:
t1 (c1)
t2 (c1, c2)
t2 fk (c1) references t1 (c1)
t3 (c1, c2, c3)
t3 fk (c1, c2) references t2 (c1, c2)
and you want to constrain c1 in t3. Well, add a foreign key from t3 to t1!
t3 fk (c1) references t1 (c1)
Now you have a constraint for c1 in t3. If you want a constrait
for c2 in t3 also, do likewise!
(I shortened the syntax somewhat but I hope you understand anyway)
-- Sport radio: people listening to people watching people having fun Mailto:roger.wernersson_at_adra.se BTW: All opinions are mine, all mine, and nobody's but mine.Received on Mon Dec 16 1996 - 00:00:00 CST
![]() |
![]() |