카테고리 없음

마이바티스(오라클) - 다중 UPDATE문 사용법, foreach

저스크라이크헤븐 2020. 3. 23. 17:20


  

1
2
3
4
5
6
7
8
9
10
<update id="seatModify" parameterType="java.util.List">
      
    <foreach collection="list" item="item" separator=";" open="DECLARE BEGIN" close="; END;">
        UPDATE SEATS SET SE_PLACE=#{item.se_place}
         <where>
        SE_CODE=#{code} AND SE_LOW=#{item.se_low} AND SE_COL=#{item.se_col}
         </where>
    </foreach>
  
</update>
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

 

foreach문 안에 

separator=";" open="DECLARE BEGIN" close="; END;" 이렇게 넣어주자