我遵循了先前在每个CONSTRAINTS之后放置逗号的说明。但是,在此表中,它给出了以下错误消息:
ORA-02264:现有约束已使用的名称
成功创建与此表关联的所有外键表。这里缺少什么?
CREATE TABLE FIELD (
ENCT_ID VARCHAR2(25) NOT NULL,
FLD_NUM NUMBER NOT NULL,
FLD_DESC VARCHAR2(50) NOT NULL,
SYMPT_CODE VARCHAR2(25),
DIAG_CODE VARCHAR2(25),
TEST_ID VARCHAR2(25),
RM_ID VARCHAR2(10) NOT NULL,
AX_CODE VARCHAR2(25) NOT NULL,
PROV_ID VARCHAR2(25) NOT NULL,
MED_NDC VARCHAR2(25),
PRIMARY KEY (ENCT_ID, FLD_NUM),
CONSTRAINT FK_ENCOUNTER FOREIGN KEY (ENCT_ID) REFERENCES ENCOUNTER(ENCT_ID),
CONSTRAINT FK_SYMPTOM FOREIGN KEY (SYMPT_CODE) REFERENCES SYMPTOM(SYMPT_CODE),
CONSTRAINT FK_DIAGNOSIS FOREIGN KEY (DIAG_CODE) REFERENCES DIAGNOSIS(DIAG_CODE),
CONSTRAINT FK_TEST FOREIGN KEY (TEST_ID) REFERENCES TEST(TEST_ID),
CONSTRAINT FK_ROOM FOREIGN KEY (RM_ID) REFERENCES ROOM(RM_ID),
CONSTRAINT FK_ASSESSMENT FOREIGN KEY (AX_CODE) REFERENCES ASSESSMENT(AX_CODE),
CONSTRAINT FK_PROVIDER FOREIGN KEY (PROV_ID) REFERENCES PROVIDER(PROV_ID),
CONSTRAINT FK_MEDICATION FOREIGN KEY (MED_NDC) REFERENCES MEDICATION(MED_NDC));
答案 0 :(得分:0)
CREATE TABLE FIELD (
ENCT_ID VARCHAR2(25) PRIMARY KEY,
FLD_NUM NUMBER PRIMARY KEY,
FLD_DESC VARCHAR2(50) NOT NULL,...
删除任何一个主键。它将是表的索引。就像学校教科书只有一个索引一样,每个表只有一个主键。