开发者

oracle help missing comma

开发者 https://www.devze.com 2022-12-19 01:44 出处:网络
I am creating this table in oracle CREATE TABLE COURSE( COURSE NUMBER(8,0) PRIMARY KEY, DESCRIPTIONVARCHAR2(50) NULL,

I am creating this table in 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
);

on doing the following insert I keep getting missing comma error but no comma is missing

INSERT INTO COURSE 
  ( COURSE NUMBER,DESCRIPTION,COST,PEREQUISITE NUMBER,CREATED_BY,开发者_如何学JAVACREATED_DATE,MODIFIED_BY,MODIFIED_DATE)
VALUES 
  (4823001,'Info Security Administration',1500,3153,'Moussa Kone','01/28/10','Moussa Kone','01/28/10');


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

should be

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

PS: Shouldn't PEREQUISITE be spelled PREREQUISITE?


Strip all those NUMBER you have in your INSERT statement. They're not part of the column name, they're the column type; and Oracle doesn't know why they're in the INSERT statement.

You have them twice: after your COURSE column, and after your PREREQUISITE column.

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');


Probably just a copy paste error, but I think Oracle insist a comma between 'course' and 'number'. So, I'd say that the solution is to remove 'number' and thus the correct insert statement is as follows

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');
0

精彩评论

暂无评论...
验证码 换一张
取 消