Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> foreign keys between 2 tables - newbie question

foreign keys between 2 tables - newbie question

From: <randp_at_kos.net>
Date: 18 May 2005 12:01:48 -0700
Message-ID: <1116441899.647961.98090@g44g2000cwa.googlegroups.com>


Hi,
I have two tables :

Employee



emp_id PK
f_name
l_name
dept_id FK (to department.dept_id)

Department



dept_id PK
name
manager_id FK (to employee.emp_id)

I guess, I can't create these tables, because when I create the employee table the foreign key breaks down. So I first created the employee table without the FK and then the department table and then did an "alter table employee" to add FK.

But, when inserting values I have the same issue. ie: referential integrity test fails.

How do I overcome this?

Is there a general rule that 2 tables can't point to each other for Foreign Keys.

thanks,
Roshan Received on Wed May 18 2005 - 14:01:48 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US