Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Referece to View as foreign key
What I am trying to do is following:
SQL> desc Artikel;
Name Null? Typ ----------------------------------------- -------- ---------------------------- TNR NOT NULL NUMBER(38) BEZEICHNUNG NOT NULL VARCHAR2(50) ARTIKEL_TYP NOT NULL VARCHAR2(50) VERKAUFSPREIS NUMBER JAHRESUMSATZ NUMBER ZEITSTEMPEL DATE
SQL>create view artikel_view as select * from artikel;
SQL> create table test_view
2 (ID NUMBER(30) Constraint test_view_pk PRIMARY KEY,
3 TNR_ART NUMBER(30) NOT NULL,
4 CONSTRAINT test_view_fk FOREIGN KEY (TNR_ART) REFERENCES
ARTIKEL_VIEW(TNR));
CONSTRAINT test_view_fk FOREIGN KEY (TNR_ART) REFERENCES
ARTIKEL_VIEW(TNR))
That gives me Error: ORA-02270
Why is this? Isnt it possible to delare the ID from a View as a primary key in Oracle?
Your help will be greatly appreciated! Received on Sat Mar 15 2003 - 14:02:46 CST