/* 使用begin end批量更新 注意end后面必須使用;結束 並且每條update語句都要用;來結束 所以close為;END; 是為了補全語法 */ <foreach collection="list" item="item" index= "index" open="BEGIN" close=";END;" separator =";"> update xxxx <set> xxxx = 100 </set> <where> ID = 'xxxx' </where> </foreach>
注意的點:
1.begin end 必須成對出現
2.end后面必須跟;結束
3.每一條語句都要以;結束
所以close是 ;END; 是為了補全語法
參考[1]:https://blog.csdn.net/aaronmer/article/details/80576191