SQL错误:ORA-00903:表名无效

时间:2014-11-10 21:43:31

标签: sql oracle

CREATE TABLE Group
(
group_name VARCHAR2(50) NOT NULL,
date_joined DATE NOT NULL,
refersTo VARCHAR2(40),
CONSTRAINT g_group_name_pk PRIMARY KEY(group_name),
CONSTRAINT g_refersTo_fk FOREIGN KEY(refersTo) REFERENCES Artist(artistic_name));

这给出了“第1行的错误:ORA-00903:无效的表名”:

CREATE TABLE Group
             *

1 个答案:

答案 0 :(得分:3)

由于Group是保留字,因此必须使用"来转义它。尝试以下操作或将表重命名为其他内容:

CREATE TABLE "Group"
(
group_name VARCHAR2(50) NOT NULL,
date_joined DATE NOT NULL,
refersTo VARCHAR2(40),
CONSTRAINT g_group_name_pk PRIMARY KEY(group_name),
CONSTRAINT g_refersTo_fk FOREIGN KEY(refersTo) REFERENCES Artist(artistic_name));