Oracle SQL开发人员“表或视图不存在”中的错误

时间:2016-03-30 23:41:31

标签: sql oracle ddl

我正在尝试在Oracle SQL开发人员中创建一个表及其索引,但我一直收到错误:

  

错误报告 -   SQL错误:ORA-00942:表或视图不存在   00942. 00000 - “表或视图不存在”   *原因:
  *操作:

我的陈述:

CREATE TABLE TAB_ATTRIBUTES_OF_RELATIONSHIP
(
REL_NAME                VARCHAR(15) not null,
ATTR_NAME             VARCHAR(15) not null, 
ATTREL_DATATYPE  VARCHAR(15) not null, 
ATTREL_DOMAIN     VARCHAR(20),

constraint PK_ATTRIBUTES_OF_RELATIONSHIP primary key (REL_Name, ATTR_NAME),
constraint FK_ATTRIBUTES_OF_RELATIONSHIP foreign key (REL_NAME)
            references RELATIONSHIPS (REL_NAME)
constraint FK_ATTRIBUTES_OF_RELATIONSHIP foreign key (ATTR_NAME)
            references ATTRIBUTES (ATTR_NAME),
);

/* Index: IDX_ATTRIBUTES_OF_RELATIONSHIP    */

Create index IDX_ATTRIBUTES_OF_RELATIONSHIP_FK on Tab_ATTRIBUTES_OF_RELATIONSHIP

(
ATTR_NAME ASC
);

1 个答案:

答案 0 :(得分:0)

问题似乎与CREATE TABLE语句有关。您应该注意放置逗号的位置,并尝试逐步执行脚本

这是表格创建声明的更正版本

CREATE TABLE TAB_ATTRIBUTES_OF_RELATIONSHIP
(
REL_NAME                VARCHAR(15) not null,
ATTR_NAME             VARCHAR(15) not null, 
ATTREL_DATATYPE  VARCHAR(15) not null, 
ATTREL_DOMAIN     VARCHAR(20),
constraint PK_ATTRIBUTES_OF_RELATIONSHIP primary key (REL_Name, ATTR_NAME),
constraint FK_ATTRIBUTES_OF_RELATIONSHIP foreign key (REL_NAME)
            references RELATIONSHIPS (REL_NAME),
constraint FK_ATTRIBUTES_OF_RELATIONSHIP foreign key (ATTR_NAME)
            references ATTRIBUTES (ATTR_NAME)
);