2015-06-29 392 views
0
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關鍵字錯誤。我該怎麼辦?

ORA-00926: missing VALUES keyword. What is wrong?

回答

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

哦!謝啦! – Marian

+1

@Marian:如果這個答案解決了您的問題,您應該通過點擊答案旁邊的投票計數下方的小複選標記來接受它。 –

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

逗號前值已被刪除。