oracle 在xml中批量插入,批量修改及多组条件查询
最近公司用ibatis开发项目,本来可以用存储过程处理批量插入,批量修改及多组条件查询;但由于使用模块相对较小,暂时就在xml中配置,以前没有在xml做过类似处理,有必要记录一下;好了,代码如下:
<!-- 批量插入 -->
<insert id="saveNotificationPushInfo" parameterClass="java.util.List">
<![CDATA[INSERT ALL]]>
<iterate conjunction="" >
into notification_push_info(
push_log_no,
business_book,
employee_id,
notification_no,
push_flag,
push_time
)values
(
bep_seq_package.fetch_seq('NOTIFICATION_PUSH_INFO','PUSH_LOG_NO','BEPDATA'),
#list[].businessBook:varchar#,
#list[].employeeId:varchar#,
#list[].notificationNo:varchar#,
#list[].pushFlag:varchar#,
sysdate
)
</iterate>
<![CDATA[SELECT * FROM dual]]>
</insert> <!-- 多组条件查询-->
<select id="getSameNotificationList" parameterClass="java.util.List" resultClass="java.util.HashMap">
select distinct employee_id "employeeId",
notification_no "notificationNo"
from notification_push_info npi
where npi.invalid_flag = 'N'
<iterate conjunction="or" open="and" close="">
npi.employee_id = #notiList[].employeeId#
and npi.business_book = #notiList[].businessBook#
and npi.notification_no = #notiList[].notificationNo#
</iterate>
</select> <!-- 批量修改-->
<update id="updateNotiList" parameterClass="java.util.List">
begin
<iterate conjunction="">
update notification_push_info set
push_flag = #list[].FLAG#,
push_time = sysdate
where invalid_flag = 'N'
and employee_id = #list[].employeeId#
and notification_no = #notiList[].notificationNo#;
</iterate>
end;
</update>
如有问题,请大家指出来,谢谢!
oracle 在xml中批量插入,批量修改及多组条件查询的更多相关文章
- oracle数据库表中,插入数据的时候如何产生一个 字母+数字 编号?
Oracle 语句中“||”代表什么啊? oracle数据库表中,插入数据的时候如何产生一个 字母+数字 编号? 排序的话,用order by来处理即可.比如:cola123a234b999b335s ...
- java 实现mongoDB 增加,删除,修改,查看,多条件查询,聚合查询,分组查询(史上最全)
首先idea创建一手springboot项目 引入如下依赖 <dependency> <groupId>org.mongodb</groupId> <arti ...
- SQL Server 2012中快速插入批量数据的示例及疑惑
SQL Server 2008中SQL应用系列--目录索引 今天在做一个案例演示时,在SQL Server 2012中使用Insert语句插入1万条数据,结果遇到了一个奇怪的现象,现将过程分享出来,以 ...
- 【mybatis】mybatis中批量插入 批量更新 batch 进行insert 和 update,或者切割LIst进行批量操作
================================================================== 分别展示 mybatis 批量新增 和 批量更新 的操作: ...
- mongodb 批量改变某一列类型 比如 String改为double,insert into select 批量插入 批量修改
//type:2代表String 1.String变Double db.集合.find({"列":{$type:2}}).forEach(function(x){ x.列=pars ...
- springMVC 接收数组参数,mybatis 接收数组参数,mybatis批量插入/批量删除案例
案例是给一个用户赋予多个权限,多个权限用其对应的主键 id 为参数,组成了 一个id数组,传给springMVC,然后springMVC传给mybatis,然后mybatis批量插入.其实类似的场景还 ...
- Dapper, 批量插入,批量更新, 以及in, like
1. 批量插入 public async Task CreateBusinessItemAsync(IEnumerable<BusinessItemsEntity> businessIte ...
- Mysql慢查询开启和查看 ,存储过程批量插入1000万条记录进行慢查询测试
首先登陆进入Mysql命令行 执行sql show variables like 'slow_query%'; 结果为OFF 说明还未开启慢查询 执行sql show varia ...
- Java:批量插入、修改数据到数据库中的用法
在java中使用JDBC实现批处理的对象一般是使用PrepareStatement对象. 如何使用: Class.forName("Oracle.jdbc.driver.OracleDriv ...
随机推荐
- Log4j2的日志配置文件,log4j2.xml文件的配置(实现控制台输出,各级别分别文件输出,自动压缩等)
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE html PUBLIC "-//W ...
- codeforces 705B:Spider Man
Description Peter Parker wants to play a game with Dr. Octopus. The game is about cycles. Cycle is a ...
- 2017-02-20 安装Sql Server2016+配置Java环境
昨天在安装Sql Server 2016时,在前面的规则检查结果中,出现“Polybase要求安装Oracle JRE7更新51(64位)或更高版本”规则失败的错误,如图 解决方案为,下载安装jdk, ...
- python如何获取多个excel单元格的值
一. 获取多个单元格的值报错:AttributeError: 'tuple' object has no attribute 'value' 需要读取的sample.xlsx 代码读取的是A3:B10 ...
- oracle 索引(3)
位图索引 位图索引非常适合于决策支持系统(Decision Support System,DSS)和数据仓库,它们不应该用于通过事务处理应用程序访问的表.它们可以使用较少到中等基数(不同值的数量)的列 ...
- js操作获取和设置cookie
//创建cookie function setCookie(name, value, expires, path, domain, secure) { var cookieText = encodeU ...
- JavaScript如何处理解析JSON数据详解
JSON (JavaScript Object Notation)一种简单的数据格式,比xml更轻巧. JSON 是 JavaScript 原生格式,这意味着在 JavaScript 中处理 JSON ...
- Ajax做日期选择
1.主页面 引入JS Jquery bootstrap 包 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN& ...
- vs2012 sln和.vcxproj有什么区别
sln是解决方案的配置,主要是管理这个方案里的多个vcxprojvcxproj是工程的配置文件,管理工程中细节比如包含的文件,引用库等一般没有sln,也可以直接打开vcxproj,也可以重新生成sln ...
- 烂泥Linux学习笔记
把最近学习过程中所写的文章整理了下:注意:本帖会持续性更新!!! 虚拟化篇:<烂泥:虚拟化KVM安装与配置><烂泥:KVM安装centos6.5系统><烂泥:KVM中安装 ...