怎么在mybatis可以创建临时表呢
滚动的轮胎 2016-07-06 12:07:11 现在项目有这样的一个需求:将大量的数据导出到excel文件中。
由于数据量比较大,直接查询大量数据导出会内存溢出,所以我想分批查询,分几次查询和导出。
这过程遇到个问题,Sysbase怎么实现查第5000条到10000条数据?
试过用临时表,想先将第1条到10000条数据放到临时表,然后倒序查第10000条到5000条数据,但是在mybatis可以创建临时表?我下面这样测试,
Xml文件:
<select id="createTemp" >
create table #temp(
Insure_id decimal,
Ins_status char(1),
Book_time datetime null
)
</select>
Dao:
sqlSessionTemplate.selectList(clazz.getName() + ".createTemp");
报错:
Caused by: java.sql.SQLException: The 'CREATE TABLE' command is not allowed within a multi-statement transaction in the 'tempdb' database.