ORACLE数据库分批更新
假设一批更新两万条数据
private static final int PAGE_SIZE = 20000;
@Autowired
private TabUserMapper tabUserMapper;
public void update(String xxid) {
int updateNum = PAGE_SIZE;
while (updateNum >= PAGE_SIZE){
updateNum = tabUserMapper.update(xxid, PAGE_SIZE) ;
}
}
int update (@Param("xxid") String xxid, @Param("pageSize") String pageSize);
mybatis中sql
<update id='update'>
update tab_user
set status ='A'
WHERE XX_ID =#{xxid}
and status ='D'
and rownum <=#{pageSize}
</update>
``