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!

foreign key errors in sql plus

611714Dec 3 2007 — edited Dec 4 2007
Hello, im pretty new to sql and i am stuck on a project in my database management class and i was wondering if anyone can help us out. I don't know if it would be easier to send what i've done or just post the error so if anyone could help it will be appreciated.

This is one part of the sql

CREATE TABLE PREREQUISITE_T
(COURSECODE VARCHAR2(10)NOT NULL,
PREREQUISITECODE VARCHAR2(20),
PRIMARY KEY (COURSECODE),
PRIMARY KEY (PREREQUISITECODE),
FOREIGN KEY (COURSECODE) REFERENCES COURSE_T(COURSECODE),
FOREIGN KEY (PREREQUISITECODE));
INSERT INTO PREREQUISITE_T VALUES ('23131', '3213');
INSERT INTO PREREQUISITE_T VALUES ('23541', '4213');
INSERT INTO PREREQUISITE_T VALUES ('23251', '3413');
INSERT INTO PREREQUISITE_T VALUES ('56131', '3513');
INSERT INTO PREREQUISITE_T VALUES ('75431', '3613');
INSERT INTO PREREQUISITE_T VALUES ('45631', '3813');
INSERT INTO PREREQUISITE_T VALUES ('65461', '3913');
INSERT INTO PREREQUISITE_T VALUES ('45351', '5413');

the error i get is
ERROR at line 1:
ORA-02298: cannot validate (STUDENT.SYS_C003016) - parent keys not found

It works fine without the primary keys but when i put in foreign keys it is all messed up. If there a a tutorial or anyone could take a look at the rest of the code i can send it out. Any help is appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 1 2008
Added on Dec 3 2007
3 comments
2,598 views