Skip to Main Content

Oracle Database Discussions

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!

foreign key from table constraint on view

665514Oct 16 2008 — edited Oct 17 2008
I am trying to create a foreign key constraint on table "OLDINFO" on the view "VIEWITEMS".
from the postings i found it looks as if this could be possible, but the way i did tried fails.

is it possible at all?
and what do I have to change to create the foreign key constraint on a view?


CREATE VIEW "VIEWITEMS" ("OBJECTID", "MAX_ACTION_OBJECTID") AS
select
objectid,
max(action_objectid) as max_action_objectid
from "OLDITEMS"
group by objectid
;

ALTER VIEW "VIEWITEMS"
ADD CONSTRAINT pk_viewedge_834289374
PRIMARY KEY (objectid)
DISABLE NOVALIDATE;

ALTER TABLE "OLDINFO"
ADD (
CONSTRAINT "OLDINFO_FK61224078273071"
FOREIGN KEY(BASEITEM_OBJECTID) REFERENCES "VIEWITEMS"(OBJECTID)
);
ORA-02270: no matching unique or primary key for this column-list
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 14 2008
Added on Oct 16 2008
7 comments
8,835 views