- #1
JOZ
- 8
- 0
Hi I am trying to create the tables below and having problems with the timeLog table referencing allocation, when I put it into the modified form of Oricle my University uses it dosent like me refrencing the refrenced values it spits out the error:
Is it even possible to refrence a value that's already being refrenced?
Is there a way to refrence both the EmpID and ProjID together from allocation so that the EmpID, ProjID pair has to exist in allocation to be used in timeLog
Code:
ORA-02256: number of referencing columns must match referenced columns
Is there a way to refrence both the EmpID and ProjID together from allocation so that the EmpID, ProjID pair has to exist in allocation to be used in timeLog
Code:
CREATE TABLE employee (
EmpID number PRIMARY KEY,
EmpName varchar2(30),
Gender varchar2(1));
CREATE TABLE project (
ProjID varchar2(2) PRIMARY KEY,
Description varchar2(30),
Budget number);
CREATE TABLE allocation (
EmpID number references employee,
ProjID varchar2(2) references project,
HourlyRate number(5,2),
PRIMARY KEY (EmpID, ProjID));
CREATE TABLE timeLog (
EmpID number references allocation,
ProjID varchar2(2) references allocation,
WeekNo number,
HrsWorked number,
PRIMARY KEY (EmpID, ProjID, WeekNo));