ORA-00933:SQL命令未正确结束在“插入”命令中

时间:2018-04-18 19:06:10

标签: sql oracle insert

我试图在线查找并阅读我的代码,但我无法找到解决方案。

我使用的是ORACLE Application Express 11G版。

Insert into Owner(O_ID, O_First, O_Last, O_Line, O_City, O_State, O_Zip, 
O_Phone, O_Email)

VALUES 

(1102, "Chris", "Leaves", "141-17 Union Turnpike Apt 3P","Flushing", "NY", 
"11367", "7182105108","chris2@gmail.com"),

(1433, "Steve", "Jobs", "88-12 Main Street","Flushing", "NY", "11367", 
"7189998476", "steve12@gmail.com"),

(2443, "Chris", "Melvin", "151-17 Jewel Avenue","Flushing", "NY", "11367", 
"7189971034","chris41@yahoo.com"),

(2425, "John", "Fellow", "131-14 Bell Blvd","Bayside", "NY", "11361", 
"7184413254","john32@yahoo.com"),

(2645, "Fish", "Mini", "171-14 169 Street", "Fresh Meadows", "NY", "11366", 
"7184435489","fish4ever@yahoo.com"),

(3514, "Aaron", "Hernadez", "51-14 Hollis Avenue","Hollis", "NY", "11423", 
"7185617865", "aaron81@gmail.com"),

(3621, "Gang", "Taylor", "230-11 Hillside Avenue","Queens Village", "NY", 
"11427", "7187764728", "Wiztaylor@gmail.com"),

(4214, "Brock", "Obama", "260-04 Hillside Avenue", "Bellerose", "NY", 
"11004", "7183432536", "brockobama@gmail.com"),  

(4314, "Astro", "Miller", "58-45 251st Street", "Little Neck", "NY", 
"11362", "7182156709", "astro214@yahoo.com"),

(4423, "Bin", "Bulu", "58-50 251st Street","Little Neck", "NY", "11362", 
"7185437832", "binbulu@gmail.com"),

(4928, "Alvin", "Chimp", "15 Garden Street", "Great Neck", "NY", "11021", 
"5168297189", "ChimpA21@gmail.com"),

(7841, "Allen", "Clover", "105 Station Road", "Great Neck", "NY", "11023", 
"5168298965", "allenC3242@yahoo.com"),

(4547, "Aiden", "Wyness", "28 Berkley Street", "Valley Stream", "NY", 
"11581", "5168258952", "aiden32421@gmail.com"),

(7849, "Derek", "Williams", "56 Hoffman Street", "Valley Stream", "NY", 
"11580", "5167918912", "DWill23@yahoo.com"),

(1892, "Antonio", "Burito", "3522 101st Street","Corona", "NY", "11368", 
"7182715567", "antonio212112@gamil.com"),

(5627, "Bob", "Iverson", "10912 34th Ave","Corona", "NY", "11368", 
"7185928911","Bobiverson23@gmail.com"),

(7829, "Phil", "Chang", "387 Andrews Rd","Mineola","NY","11501", 
"5168331106", "phillchang9@gmail.com"),

(8526, "Jacky", "Chu", "313 Columbus Pkwy", "Mineola", "NY", "11501", 
"5162487912", "jackychu54@gmail.com"),

(1720, "Kiba", "Wolf", "122 Beech St","Floral Park", "NY", "11001", 
"5163305792", "kibawolf4@gmail.com"),

(1920, "Kakashi", "Hatake", "40 Beechhurst Ave","Floral Park", "NY", "11001", 
"5168309910", "HatakeKaskashi@gmail.com");

这只是示例数据,例如原因。我遇到了这个错误:

  

ORA-00933:SQL命令未正确结束。

我不知道是什么原因,即使我遵循语法

INSERT INTO table_name
VALUES (value1, value2, value3, ...);

任何帮助都会非常感谢你!

1 个答案:

答案 0 :(得分:0)

  • 您需要为每个要插入的VALUES包含一个INSERT INTO
  • 在处理字符串时使用单引号替换双引号
  • 每个INSERT语句都必须以分号结尾

例如(我正在创建一个虚拟表,因为你没有提供CREATE TABLE语句):

refs/...

或者,您可以使用SQL> create table owner 2 (o_id number, 3 o_first varchar2(20), 4 o_last varchar2(20), 5 o_line varchar2(100), 6 o_city varchar2(50), 7 o_state varchar2(10), 8 o_zip varchar2(10), 9 o_phone varchar2(20), 10 o_email varchar2(50)); Table created. SQL> SQL> insert into owner 2 (o_id, o_first, o_last, o_line, o_city, o_state, o_zip, o_phone, o_email) 3 values 4 (1102, 'Chris', 'Leaves', '141-17 Union Turnpike Apt 3P','Flushing', 'NY', 5 '11367', '7182105108','chris2@gmail.com'); 1 row created. SQL> SQL> insert into owner 2 (o_id, o_first, o_last, o_line, o_city, o_state, o_zip, o_phone, o_email) 3 values 4 (1433, 'Steve', 'Jobs', '88-12 Main Street','Flushing', 'NY', '11367', 5 '7189998476', 'steve12@gmail.com'); 1 row created. SQL>

INSERT ALL

或者,SQL> insert all 2 into owner 3 (o_id, o_first, o_last, o_line, o_city, o_state, o_zip, o_phone, o_email) 4 values 5 (1102, 'Chris', 'Leaves', '141-17 Union Turnpike Apt 3P','Flushing', 'NY', 6 '11367', '7182105108','chris2@gmail.com') 7 into owner 8 (o_id, o_first, o_last, o_line, o_city, o_state, o_zip, o_phone, o_email) 9 values 10 (1433, 'Steve', 'Jobs', '88-12 Main Street','Flushing', 'NY', '11367', 11 '7189998476', 'steve12@gmail.com') 12 select * from dual; 2 rows created. SQL>

UNION (ALL)

现在您有3个选项,选择一个。