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!

Creating a foreign key on a view

43298Aug 20 2002
Hi to all,

is it possible to create a foreign key to a view?

Let's say I created a view v_emp in scott like (create view v_emp as select * from emp). Then I go to "system" and I have a table named "test" which contains a column "empno". Thus I like to define a constraint which goes like

alter table test add constraint fk_empno foreign key (empno) references scott.v_emp (empno);

and results in an ORA-02444 "Cannot resolve referenced object in referential constraints"

This seems to tell me that I can only reference tables. Is this really true? I just can't believe this!

regards
Stefan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 17 2002
Added on Aug 20 2002
2 comments
638 views