在Oracle Application Express中。我创建了一个名为Employees的表。我想通过单个命令插入多行值。我用了这个命令
INSERT INTO Employees
VALUES(
(100,'Steven','King','SKING','515.123.4567',TO_DATE('06-17-1987','MM- DD-YYYY'),'AD_PRESS',24000,NULL,NULL,90),
(101,'Neena','Kochar','NKOCHHAR','515.123.4568',TO_DATE('09-21-1989','MM-DD-YYYY'),'AD_VP',17000,NULL,100,90),
);
我得到 ORA-00907:错过右括号错误。我的错误在哪里? Thnx提前。
答案 0 :(得分:1)
这不是Oracle
;
要插入多行,可以使用union all
或insert all
insert into tbl (
select val1, val2 from dual
union all
select val2, val4 from dual
....
);
或
insert all
into tbl(clm1, clm2) values (val1, val2)
into tbl(clm1, clm2) values (val3, val4)
....
select 1 from dual;
答案 1 :(得分:0)
试试这个:
INSERT INTO Employees
select 100,'Steven','King','SKING','515.123.4567',TO_DATE('06-17-1987','MM- DD-YYYY'),'AD_PRESS',24000,NULL,NULL,90
union select 101,'Neena','Kochar','NKOCHHAR','515.123.4568',TO_DATE('09-21-1989','MM-DD-YYYY'),'AD_VP',17000,NULL,100,90
答案 2 :(得分:0)
你需要做一个INSERT ALL
http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_9014.htm
INSERT ALL
INTO Employees (cols) values (100,'Steven','King','SKING','515.123.4567',TO_DATE('06-17-1987','MM- DD-YYYY'),'AD_PRESS',24000,NULL,NULL,90)
INTO Employees (cols) values (101,'Neena','Kochar','NKOCHHAR','515.123.4568',TO_DATE('09-21-1989','MM-DD-YYYY'),'AD_VP',17000,NULL,100,90)
select * from dual