SQL语句中的错误(基本)

时间:2017-03-31 06:37:34

标签: sql oracle oracle11g oracle-sqldeveloper

我正在为大学练习创建表格,但我一直在执行查询时遇到错误而无法找到错误。 SQL Developer很难指定它。

这是SQL Developer输出:

Error stating in line 58:
CREATE TABLE deportexevento(
  id_evento NUMBER NOT NULL,
  id_deporte NUMBER NOT NULL,
  CONSTRAINT pk_deportexevento PRIMARY KEY (id_evento, id_deporte),
  CONSTRAINT fk_evento_deportexevento
    FOREIGN KEY (id_evento)
    REFERENCES evento(id),
  CONSTRAINT fk_deporte_deportexevento
    FOREIGN KEY (id_deporte)
    REFERENCES deporte(id)
)

CREATE TABLE evaluador(
  cuil VARCHAR(15) NOT NULL,
  nombre VARCHAR(60) NOT NULL,
  email VARCHAR(60) NOT NULL,
  CONSTRAINT pk_evaluador PRIMARY KEY (cuil)
)
Error report -
Error SQL: ORA-00922: missing or invalid option
00922. 00000 -  "missing or invalid option"
*Cause:    
*Action:

完整SQL:https://pastebin.com/pfCz5Jwt

1 个答案:

答案 0 :(得分:1)

在每个create语句后尝试使用分号,如下所示......

CREATE TABLE deportexevento
(
    id_evento NUMBER NOT NULL,
    id_deporte NUMBER NOT NULL,
    CONSTRAINT pk_deportexevento PRIMARY KEY ( id_evento, id_deporte ),
    CONSTRAINT fk_evento_deportexevento
        FOREIGN KEY ( id_evento )
        REFERENCES evento( id ),
    CONSTRAINT fk_deporte_deportexevento
        FOREIGN KEY ( id_deporte )
        REFERENCES deporte( id )
);
CREATE TABLE evaluador
(
    cuil VARCHAR( 15 ) NOT NULL,
    nombre VARCHAR( 60 ) NOT NULL,
    email VARCHAR( 60 ) NOT NULL,
    CONSTRAINT pk_evaluador PRIMARY KEY ( cuil )
);