Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: FK Constraint for 2 tables with many-many relationship ?
The 'official' way is to have a so-called mapping or junction table between
those two tables
like this
table a(m) junction(m,n) table b(n)
where m and n are the primary keys and the combination m,n is a primary key
in junction, with foreign keys to the junction table.
No need to write triggers.
A case tool would have created such a table automatically.
Hth,
--
Sybrand Bakker, Oracle DBA
Noodles <noodles_at_aol.com> wrote in message
news:19990905220831.28288.00003467_at_ng-fl1.aol.com...
> I need to create a foreign key constraint between 2 tables that do not
have a
> primary key relationship. Basically it's a many-to-many relationship and
there
> are no columns to create a primary key on.
>
> I suppose I could modify the audit trigger and on inserts and updates do a
> quick SQL select to make sure the child data exists at least once in the
parent
> table but wouldn't that just kill performance ?
>
> Are there any other ways to accomplish this ?
>
> Thanks,
> Cliff
Received on Sun Sep 05 1999 - 23:50:49 CDT
![]() |
![]() |