데이터베이스
Mybatis Postgresql foreach update (다중 업데이트)
터프남
2023. 12. 19. 21:47
728x90
반응형
환경
- spring boot 2.7.18
- postgresql
foreach 태그를 활용해서 멀티 업데이트를 해야할 경우
mybatis xml
<update id="update" parameterType="java.util.List">
<foreach collection="list" item="item" separator=";">
UPDATE TABLE
SET FIELD = 'FIELD'
WHERE FIELD = #{item.id}
</foreach>
</update>
728x90
반응형