oracle帮助缺少逗号

时间:2010-01-29 19:20:04

标签: sql oracle

我在oracle中创建这个表

CREATE TABLE COURSE  (
     COURSE NUMBER(8,0) PRIMARY KEY,
     DESCRIPTION  VARCHAR2(50) NULL,
     COST NUMBER(9,2) NULL,
     PEREQUISITE NUMBER(8,0)  NULL,
     CREATED_BY VARCHAR2(30) NOT NULL,
     CREATED_DATE DATE NOT NULL,
     MODIFIED_BY VARCHAR2(30) NOT NULL,
     MODIFIED_DATE DATE NOT NULL
);

在执行以下插入时,我一直错过逗号错误,但没有逗号丢失

INSERT INTO COURSE 
  ( COURSE NUMBER,DESCRIPTION,COST,PEREQUISITE NUMBER,CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE)
VALUES 
  (4823001,'Info Security Administration',1500,3153,'Moussa Kone','01/28/10','Moussa Kone','01/28/10');

3 个答案:

答案 0 :(得分:12)

INSERT INTO COURSE ( COURSE NUMBER, ...
                 ... PEREQUISITE NUMBER, ...

应该是

INSERT INTO COURSE ( COURSE, ...
                 ... PEREQUISITE, ...

PS:不应该PEREQUISITE拼写PREREQUISITE

答案 1 :(得分:5)

NUMBER语句中删除您拥有的所有INSERT。它们不是列名的一部分,它们是列类型;并且Oracle不知道为什么他们在INSERT声明中。

您有两次:在COURSE列之后,在PREREQUISITE列之后。

INSERT INTO COURSE (COURSE, DESCRIPTION, COST, PEREQUISITE, CREATED_BY, CREATED_DATE, MODIFIED_BY, MODIFIED_DATE)
   VALUES (4823001,'Info Security Administration',1500,3153,'Moussa Kone','01/28/10','Moussa Kone','01/28/10');

答案 2 :(得分:-1)

可能只是一个复制粘贴错误,但我认为Oracle坚持在'course'和'number'之间使用逗号。所以,我会说解决方案是删除'number',因此正确的insert语句如下

INSERT INTO COURSE ( COURSE ,DESCRIPTION,COST,PEREQUISITE,CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE)
   VALUES (4823001,'Info Security Administration',1500,3153,'Moussa Kone','01/28/10','Moussa Kone','01/28/10');