多行插入的正确写法(经测试,OK):
一、
insert all
into students values ('0515101143','蔡雪松','','05工本2班')
into students values ('0515102003','纪川','','05科本1班')
select * from dual;
二、
insert into students
select 0515101145,'蔡雪松','','05工本2班' from dual
union
select 0515102005,'纪川','','05科本1班' from dual;
三、
insert into students
select ‘0515101145’,'蔡雪松','','05工本2班' from dual
union
select ’0515102005‘,'纪川','','05科本1班' from dual;
注意:二和三之间的差别就是一个有符号 ' ' ,一个无 ' ' 符号 。二和三的select同时写,会报错。
-----------------------------错误的写法如下---------------------------------------------------
一、
insert into students
values
('0515101143','蔡雪松','','05工本2班'),
('0515102003','纪川','','05科本1班');
二、
insert into students(sid,sname,email,grade)
values
('0515101144','蔡雪松','','05工本2班')&
('0515102003','纪川','','05科本1班');
三、
insert into students
select '0515101144','蔡雪松','','05工本2班' from dual
union all
select '0515102004','纪川','','05科本1班';
注释:网上有资料中0515101144是没有符号 '' 的,但测试中仍然报错。
转至:http://blog.163.com/wspjing@126/blog/static/11772053420125105338609/