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 ...
随机推荐
- Qt5.3.2_vs10_发布时所需DLL的路径
1. ???\Qt5.3.2_vs2010\5.3\msvc2010_opengl\bin 2.
- 本地的html服务
本地的调试的时候, 我们服务器返回的cookie就会变的失效,因为你的本地服务器的域名不太对.
- JAVA中的泛型类型不可以直接初始化
class Para<CLS>{ private CLS class1; public Para(CLS class1) { ...
- java:Writer/Reader字符流操作
字符流的操作: 字节流的操作,是直接映射文件的:file->文件 字符流的操作是需要存在缓存区的:file->缓冲区->文件 (中文处理,一般用字符流) public static ...
- 2017-02-23 .NET Core Tools转向使用MSBuild项目格式
微软之前为了让.NET Core和ASP.NET Core能够支持Windows Visual Studio之外的开发平台,创建了基于project.json格式的项目系统.不过可惜,这种格式与之前的 ...
- CentOS 7 安装 Git
服务器端 1.先从yum安装git yum –y install git 2.在需要的位置创建一个裸仓库(最后以.git结尾) cd /usr/local mkdir git cd git git i ...
- Android环境配好的标志
Window —> preference —> android
- C# 6.0 (VS2015 CTP6)
/* C# 6.0 demo https://github.com/dotnet/roslyn/wiki/Languages-features-in-C%23-6-and-VB-14 */ using ...
- 关于C++中的pow小记(转)
昨天在敲一个数位DP的问题,但是用到了这个坑D的问题,找了半天错,还以为又是什么奇怪的算法,结果发现思路一致,然后自己各种YY修改,最后不得不和正确答案比对,但是最后发现标准答案和自己的想法几乎一模一 ...
- LeetCode OJ:Count Complete Tree Nodes(完全二叉树的节点数目)
Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from W ...