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 ...
随机推荐
- Linux嵌入式 -- 内核 - 内核链表
1. linux内核链表 链表数据结构的定义: struct list_head { struct list_head *next, *prev; }; list_head结构包含两个指向li ...
- Visual Studio 当前不会命中断点的问题 编辑pdf文件
Visual Studio 当前不会命中断点的问题 PDB文件概述
- Angular表单的本地校验和远程校验
AngularJS Form 进阶:远程校验和自定义输入项 表单远程校验 HTML代码: <!doctype html> <html ng-app="form-exampl ...
- windows7下cmd窗口使用ssh命令
http://jingyan.baidu.com/article/36d6ed1f931eb31bcf4883dc.html
- 请求被中止: 未能创建 SSL/TLS 安全通道,以及解决方法,即:Could not create SSL/TLS secure channel
C# 访问https请求被中止: 未能创建 SSL/TLS 安全通道(Could not create SSL/TLS secure channel) 以及 X509Certificate2 temp ...
- 为mac终端添加tree命令
原文:http://superuser.com/questions/359723/mac-os-x-equivalent-of-the-ubuntu-tree-command/ 整理步骤如下: $ t ...
- hdu 5238 Calculator(线段树,中国剩余定理¥)
Calculator Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Tot ...
- 【Prism】MEF版HelloWorld
引言 Pirsm框架是由微软P & P小组设计的,用于构建组合式的WPF企业级应用,支持两个IOC容器,分别为Unity和MEF.官方地址为http://compositewpf.codepl ...
- 编写高效的CSS选择器
高效的CSS已经不是一个新话题,也不是一个我非得重拾的话题,但是,它却是自我在SKY工作以后,真正感兴趣并始终关注的一个话题. 很多人或者忘记了,或者仅仅是没有意识到,CSS可以是高效的也可能导致低能 ...
- MongoDB 高可用集群搭建(3.4)
一.架构概况192.168.56.101192.168.56.102192.168.56.103OS为centos 7.2 架构图: 规划5个组件对应的端口号,由于每台机器均需要同时部署 mong ...