Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Primary and Foreign key problem

Primary and Foreign key problem

From: JoaopRAMOS <joaopramos_at_aol.com>
Date: 07 Sep 2002 06:22:29 GMT
Message-ID: <20020907022229.12660.00002256@mb-mg.aol.com>

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 tutorial

(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));
Received on Sat Sep 07 2002 - 01:22:29 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US