ORA-00926:缺少VALUES关键字错误。我该怎么办?

时间:2015-06-29 11:37:57

标签: oracle

insert into Members
  (FIRST_NAME,LAST_NAME,DOB,GENDER,MOBILE,EMERGENCY_NAME,
  EMERGENCY_PHONE,EMAIL,MEDICAL_HISTORY,ADDRESS,START_DATE,
  PLAN,ID)
,values('n1','n2','02.05.1998','M','5456764645','h',
'566576876','fhsfsdfo','none','bla','29.10.2015',
8,1);

FIRST_NAME,LAST_NAME,GENDER,MOBILE,EMERGENCY_NAME,EMERGENCY_PHONE,
EMAIL,MEDICAL_HISTORY,ADDRESS are varchar(30)-s

ID is int and the primary key

DOB and START_DATE are DATE-s

PLAN is int.

我收到以下错误:

  

ORA-00926:缺少VALUES关键字。有什么问题?

2 个答案:

答案 0 :(得分:2)

,之前,您的查询中有一个逗号(VALUES)。删除它:

insert into Members(FIRST_NAME,LAST_NAME,DOB,GENDER,MOBILE,EMERGENCY_NAME,EMERGENCY_PHONE,EMAIL,MEDICAL_HISTORY,ADDRESS,START_DATE,PLAN,ID) 
values('n1','n2','02.05.1998','M','5456764645','h','566576876','fhsfsdfo','none','bla','29.10.2015',8,1);

答案 1 :(得分:0)

Oracle Insert的语法如下所示。

INSERT INTO table_name(column1, column2, column3) VALUES ('value1','value2','value3');

所以你的代码是这样的

insert into Members(FIRST_NAME,LAST_NAME,DOB,GENDER,MOBILE,EMERGENCY_NAME,EMERGENCY_PHONE,EMAIL,MEDICAL_HISTORY,ADDRESS,START_DATE,PLAN,ID) values('n1','n2','02.05.1998','M','5456764645','h','566576876','fhsfsdfo','none','bla','29.10.2015',8,1);

必须删除之前的逗号。