[DB] MyBatis(Oracle DB) 에서 다중 Update

seoyoon·2023년 4월 12일
0

0. 개요

Maybatis에서 foreach를 사용해서 다중 update를 해보려고 합니다.
DBMS는 오라클 입니다.

1. mapper.xml

<update id="updateList" parameterType="java.util.Map">
	<foreach collection="list" item="item" index="index" separator=";" open="DECLARE BEGIN" close="; END;">
		UPDATE TEMP
			CONTENT
		<where>
        NO = #{item.no}
        </where>
	</foreach>
</update>

insert와 다르게 separator=";" open="DEVLARE BEGIN" close=";END;"를 작성해주면 됩니다.

profile
Backend Developer

0개의 댓글