foreign key from table constraint on view
665514Oct 16 2008 — edited Oct 17 2008I 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