Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: [Q] circular foreign key constraints
I didn't quite understand your setup since you mention person, contact_person etc. But let's say we have a table for persons and a table for meetings.
In general one person may attend zero or more meetings, and one meeting must have one or more persons (Or, depending on the definition of meeting, two or more persons).
This is what's called a many-to-many relationship and a common solution is to have a third table - person_meetings - which has a row for each person at each meeting. Person_meetings is foreign keyed to persons and also to meetings.
Van
Nikolaus Rumm <nikolaus.rumm_at_spamremoveme.chello.at> wrote in message
news:uLY95.6849$7D2.116639_at_news.chello.at...
> Hello,
>
> maybe this is a silly question, but my problem is serious:
>
> I have 2 tables, say 'Meeting' and 'Person', that are in a 1:n
relationship,
> where meeting is the 1 side and Person is the n side.
> So Person has a foreign key constraint on Meeting. So far so good.
> However, I need exactly one contact person per Meeting, so my approach is
to
> add an additional foreign key constraint between Meeting and Person.
>
> Well, sounds good, but I can't create the tables, as Oracle says that the
> foreign key referrer is not known.
> How to handle this situation ? Should I create the tables separately and
add
> the foreign key constraints manually ?
>
> Any suggestions ?
>
> Thx
>
> Nikolaus
>
>
Received on Sun Jul 09 2000 - 00:00:00 CDT
![]() |
![]() |