Inserting multiple rows into table - getting error ORA-00933: SQL command not properly ended

白昼怎懂夜的黑 提交于 2021-02-11 18:12:15

问题


create table employee (      
  employee_id number (5), 
  first_name varchar2(100), 
  last_name varchar2(100), 
  salary number (10), 
  department_id number(5), 
  hire_date date,
  constraint pk_emp primary key (employee_id) 
  )

  insert into employee (employee_id, last_name, salary )     
   values
   (129, 'khaj', 19000),
   (130, 'ravi', 20000);

enter image description here


回答1:


Wrong syntax.

Either

insert into employee (employee_id, last_name, salary)
  values (129, 'khaj', 19000);
insert into employee (employee_id, last_name, salary)
  values (130, 'ravi', 20000);

or

insert into employee (employee_id, last_name, salary)
  select 129, 'khaj', 19000 from dual union all
  select 130, 'ravi', 20000 from dual;

or even

insert all
  into employee (employee_id, last_name, salary) values (129, 'khaj', 19000)
  into employee (employee_id, last_name, salary) values (130, 'ravi', 20000)
select * from dual;


来源:https://stackoverflow.com/questions/59416521/inserting-multiple-rows-into-table-getting-error-ora-00933-sql-command-not-pr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!