Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Question: Foreign Key references different column in same table

1030605Aug 7 2013 — edited Aug 7 2013

Hello,

I'm not grasping this concept. Would you be able to provide the logic how and why you would create a foreign key that references a column in the same table?

For example, referencing the below Schema, SupervisorNo@ is a FOREIGN KEY to the 'EmpNo' column in the same table.

EMPLOYEE (EmpNo, Title, Fname, Lname, Phone, Email, DOB, Gender, Salary, HireDate, OutNo, SupervisorNo@)


Why would you want to do this and how can it be used? If you're populating data into the table, and this constraint is enabled, you wont be able to load anything because the 'EmpNo' column will be blank.


Any input you can provide me around this would be greatly appreciated. Thanks!



This post has been answered by Ishan on Aug 7 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 4 2013
Added on Aug 7 2013
3 comments
584 views