insert into t_fms_og_dictionary (DIC_KEY,DIC_LANG,DIC_VALUE) select ?,?,? from dual union all select ?,?,? from dual union all select ?,?,? from dual 用以上方法一次插入三条数据 在pstmt.executeBatch();提交批量数据
use master go if exists(select * from sys.databases where name = 'stuDB') drop database stuDB go create database stuDB GO USE stuDB GO if exists(select * from sys.objects where name='stuinfo') drop table stuinfo go create table stuinfo( id int identity not null, stuname varchar(10) not null, sex varchar(10) not null, cencet varchar(20) not null ) go if exists(select * from sys.objects where name ='pk_id') alter table stuinfo drop constraint pk_id go alter table stuinfo add constraint pk_id primary key (id) declare @i int set @i = 1 while @i <10000 begin insert into stuinfo values('NAME'+convert(varchar(10),@i),'SEX'+convert(varchar(10),@i),'cencet'+convert(varchar(10),@i)) set @i=@i+1 end go select * from stuinfo
循环调用addBatch(sql语句);
然后执行executeBatch()方法;
select ?,?,? from dual
union all
select ?,?,? from dual
union all
select ?,?,? from dual
用以上方法一次插入三条数据
在pstmt.executeBatch();提交批量数据
go
if exists(select * from sys.databases where name = 'stuDB')
drop database stuDB
go
create database stuDB
GO
USE stuDB
GO
if exists(select * from sys.objects where name='stuinfo')
drop table stuinfo
go
create table stuinfo(
id int identity not null,
stuname varchar(10) not null,
sex varchar(10) not null,
cencet varchar(20) not null
)
go
if exists(select * from sys.objects where name ='pk_id')
alter table stuinfo
drop constraint pk_id
go
alter table stuinfo
add constraint pk_id primary key (id)
declare @i int
set @i = 1
while @i <10000
begin
insert into stuinfo values('NAME'+convert(varchar(10),@i),'SEX'+convert(varchar(10),@i),'cencet'+convert(varchar(10),@i))
set @i=@i+1
end
go
select * from stuinfo