Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> referencing composite key in create table statement
Hi,
I'm trying to create a table in which a foriegn key of 3 attributes reference a composite key of 3 attributes in another by doing this:
create table student (
student_id CHAR(8) NOT NULL, enroll_tutorial_day VARCHAR2(9), enroll_tutorial_time CHAR(5), enroll_tutorial_room VARCHAR2(7), attend_tutorial_day VARCHAR2(9), attend_tutorial_time CHAR(5), attend_tutorial_room VARCHAR2(7),
and it keeps telling me this:
constraint student_attend_fk foriegn key (attend_tutorial_day, attend_tutorial
*ERROR at line 9:
I don't understand, - there are ten left parentheses and ten right parentheses?
Cameron
P.s. in case you are wondering here is the script until that point:
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 WeeklyQuestionsReceived on Thu Aug 29 2002 - 07:46:09 CDT
(week_number VARCHAR2(2) NOT NULL,
employee_id CHAR(8), due_datetime DATE, constraint weeklyquestions_week_number_pk PRIMARY KEY (week_number), constraint weeklyquestions_employee_id_fk FOREIGN KEY (employee_id) references Academic (employee_id)); create table Tutorial
(tutorial_day VARCHAR2(9) NOT NULL,
tutorial_time CHAR(5) NOT NULL, tutorial_room VARCHAR2(7) NOT NULL, academic_id CHAR(8), constraint tutorial_daytimeroom_ck primary key (tutorial_day, tutorial_time, tutorial_room), constraint tutorial_academic_id_fk foreign key (academic_id) references academic (employee_id));
![]() |
![]() |