CREATE TABLE WORKORDERS
(wo# NUMBER(10) CONSTRAINT WORKORDERS_wo#_pk PRIMARY KEY,
proj# NUMBER(10) NOT NULL,
wo_Desc VARCHAR2(100) NOT NULL,
wo_Assigned VARCHAR2(50),
wo_Hours NUMBER(3) NOT NULL,
wo_Start DATE(YYYY-MM-DD),
wo_Due DATE(YYYY-MM-DD),
wo_Complete CHAR(1)
CONSTRAINT WORKORDER_wo_Complete_ck CHECK(wo_Complete IN('Y','N')),
CONSTRAINT WORKORDER_proj#_fk FOREIGN KEY (proj#) REFERENCES PROJECT (proj#),
CONSTRAINT WORKORDERS_wo_Desc_unq UNIQUE,
CONSTRAINT WORKORDERS_wo_Hours_ck CHECK(wo_Hours > 0))
oracle为我强调的问题是
wo_Start DATE(YYYY-MM-DD),
E(Y
建议添加REFERENCE或CONSTRAINT,但我不认为会修复它。它看起来很好,我不确定为什么它只会给我一个跨越3个字符的错误。
答案 0 :(得分:1)
如果外键引用有效,我希望以下内容有效:
CREATE TABLE WORKORDERS (
wo# NUMBER(10) CONSTRAINT WORKORDERS_wo#_pk PRIMARY KEY,
proj# NUMBER(10) NOT NULL,
wo_Desc VARCHAR2(100) NOT NULL,
wo_Assigned VARCHAR2(50),
wo_Hours NUMBER(3) NOT NULL,
wo_Start DATE,
wo_Due DATE,
wo_Complete CHAR(1),
CONSTRAINT WORKORDER_wo_Complete_ck CHECK (wo_Complete IN ('Y','N')),
CONSTRAINT WORKORDER_proj#_fk FOREIGN KEY (proj#) REFERENCES PROJECT (proj#),
CONSTRAINT WORKORDERS_wo_Desc_unq UNIQUE (wo_Desc),
CONSTRAINT WORKORDERS_wo_Hours_ck CHECK (wo_Hours > 0)
);
问题: