oracle ORA-00926: 缺少 VALUES 关键字错误。我该怎么办?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31114701/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:56:17 来源:igfitidea点击:
ORA-00926: missing VALUES keyword error. What should I do?
提问by Marian
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.
I get the following error:
我收到以下错误:
ORA-00926: missing VALUES keyword. What is wrong?
ORA-00926: 缺少 VALUES 关键字。怎么了?
回答by Raging Bull
You have a comma (,
) in your query before VALUES
. Remove it:
您,
之前的查询中有一个逗号 ( ) 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);
回答by Caroffrey
Syntax for Oracle Insert is as below.
Oracle Insert 的语法如下。
INSERT INTO table_name(column1, column2, column3) VALUES ('value1','value2','value3');
So your code goes this way
所以你的代码是这样的
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);
The comma before value has to be removed.
必须删除值前的逗号。