查询出了什么问题?

时间:2015-12-17 12:11:50

标签: oracle10g

INSERT INTO EMP_COMPANY(ename,cname,salary,jdate) VALUES
('ANIL','ACC',1500.00,'01-MAY-89'),
........
('AMOL','ACC',1000.00,'17-MAR-95');

错误:ORA-00933:SQL命令未正确结束。 语法中缺少什么?

1 个答案:

答案 0 :(得分:2)

你不能像你一样做多个记录。你可以尝试这样:

INSERT INTO EMP_COMPANY(ename,cname,salary,jdate) 
select 'ANIL','ACC',1500.00,'01-MAY-89' from dual
union all 
select 'SHANKAR','TATA',2000.00,'10-MAY-90' from dual
union all
select 'JAYA','CMC',1800.00,'7-JULY-91' from dual
union all
select 'SUNIL','CMC',1700.00,'1-JAN-88' from dual
union all
select 'VIJAY','TATA',5000.00,'3-JAN-88' from dual
union all
select 'PRAKASH','TATA',3000.00,'27-MAY-89' from dual

还有一个选项可以像这样使用INSERT ALL

   INSERT ALL
   INTO EMP_COMPANY (ename,cname,salary,jdate) VALUES ('ANIL','ACC',1500.00,'01-MAY-89')
   INTO EMP_COMPANY  (ename,cname,salary,jdate) VALUES ('SHANKAR','TATA',2000.00,'10-MAY-90')
   INTO EMP_COMPANY  (ename,cname,salary,jdate) VALUES ('JAYA','CMC',1800.00,'7-JULY-91')
   ...........
   SELECT 1 FROM DUAL;