Oracle + MyBatis 批量更新 update

xml 复制代码
<update id="updateUserDO' parameterType="list"> 
<foreach collection="list" item="param" separator="" open="begin" close="end;">
        update user
        <set>
        <if test="null!=param.account and ''!=param.account">
         account =#{param.account},
        </if>
        <if test="null!=param.userName and ''!=param.userName">
        user_name =#{param.userName},
        </if>
    </set>
    where uuid = #{param.uuid};
</foreach>
</update>

注意:where最后有个分号

其实最后SQL格式就是

begin

update xxx set xxx where xxx;

update xxx set xxx where xxx;

end;

是一个SQL块

相关推荐
kura_tsuki2 小时前
[Oracle数据库] Oracle 常用函数
数据库·oracle
YA3333 小时前
java基础(十)sql的mvcc
数据库
weixin_307779137 小时前
VS Code配置MinGW64编译SQLite3库
开发语言·数据库·c++·vscode·算法
SelectDB7 小时前
Apache Doris 4.0 AI 能力揭秘(一):AI 函数之 LLM 函数介绍
数据库·人工智能·数据分析
我是哈哈hh7 小时前
【MySQL】在UBuntu环境安装以及免密码登录入门
linux·数据库·mysql·ubuntu
HeyZoeHey7 小时前
Mybatis执行sql流程(一)
java·sql·mybatis
喪彪8 小时前
MySQL新手教学
数据库·mysql·adb
丘大梨10 小时前
QT 基础聊天应用项目文档
运维·数据库·系统架构
HMBBLOVEPDX11 小时前
MySQL的多版本并发控制(MVCC):
数据库·mysql·mvcc