Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Primary and Foreign key problem
The following script reports the error ORA-02270. It's regarding the table Students. I don't know if I created right the FKs. Can anybody help me please?
Thank you
create table academic
(employee_id CHAR(8) not null,
surname VARCHAR2(20) not null, first_name VARCHAR2(15) not null, CONSTRAINT academic_employee_id_pk primary key (employee_id)); create table tutorialReceived on Sat Sep 07 2002 - 01:22:29 CDT
(academic_id CHAR(8) null,
tu_day VARCHAR2(9) not null, tu_time CHAR(5) not null, tu_room VARCHAR2(7) not null, CONSTRAINT tutorial_tdtimtr_pk primary key (tu_day, tu_time, tu_room), CONSTRAINT tutorial_academic_id_fk foreign key (academic_id) references academic (employee_id)); create table student
(student_id CHAR(8) not null,
en_tu_day VARCHAR2(9) null, en_tu_time CHAR(5) null, en_tu_room VARCHAR2(7) null, attend_tu_day VARCHAR2(9) null, attend_tu_time CHAR(5) null, attend_tu_room VARCHAR2(7) null, CONSTRAINT student_student_id_pk primary key (student_id), CONSTRAINT student_en_tu_day_fk1 foreign key (en_tu_day) references tutorial (tu_day), CONSTRAINT student_en_tu_time_fk1 foreign key (en_tu_time) references tutorial (tu_time), CONSTRAINT student_en_tu_room_fk1 foreign key (en_tu_room) references tutorial (tu_room), CONSTRAINT student_attend_tu_day_fk2 foreign key (attend_tu_day) references tutorial (tu_day), CONSTRAINT student_attend_tu_time_fk2 foreign key (attend_tu_time) references tutorial (tu_time), CONSTRAINT student_attend_tu_room_fk2 foreign key (attend_tu_room) references tutorial (tu_room));