sql循环遍历

 <sql id="Example_Where_Clause" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Jan 18 10:58:08 CST 2016.
    -->
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
时间: 2024-08-19 03:57:58

sql循环遍历的相关文章

Oracle动态游标实现动态SQL循环遍历,和静态游标的比较。

动态游标可以遍历动态的表, 格式: TYPE 游标类型 IS REF CURSOR; --定义一个动态游标游标名 游标类型; 如果查询的表的数据不同的,动态变化的,这时候可以用动态游标. 需要注意的是,动态游标的定义, 在普通存储过程中:需要放在 is 后面的第一行. 动态游标通过:open 游标 for 字符串,形式使用,遍历. create or replace procedure P_TEST_SQL is TYPE ref_cursor_type IS REF CURSOR; --定义一

SQL SERVER循环遍历(普通循环和游标循环)

1.首先需要一个测试表数据Student 2.普通循环 1)循环5次来修改学生表信息 --循环遍历修改记录--declare @i int   set @i=0while @i<5begin    update Student set demo = @i+5 where [email protected]    set @[email protected] +1 end--查看结果--select * from Student 2)执行后的查询结果 3.游标循环(没有事务) 1)根据学生表实际数

sqlserver中的循环遍历(普通循环和游标循环)

sql 经常用到循环,下面介绍一下普通循环和游标循环 1.首先需要一个测试表数据Student 2.普通循环 1)循环5次来修改学生表信息 --循环遍历修改记录--declare @i int   set @i=0while @i<5begin    update Student set demo = @i+5 where [email protected]    set @[email protected] +1 end--查看结果--select * from Student 2)执行后的查

To Java程序员:切勿用普通for循环遍历LinkedList

ArrayList与LinkedList的普通for循环遍历 对于大部分Java程序员朋友们来说,可能平时使用得最多的List就是ArrayList,对于ArrayList的遍历,一般用如下写法: public static void main(String[] args) { List<Integer> arrayList = new ArrayList<Integer>(); for (int i = 0; i < 100; i++) arrayList.add(i);

c# winform 循环遍历界面上的所有控件,foreach,Controls,AllowDrop

foreach (System.Windows.Forms.Control control in this.groupBox2.Controls)//遍历groupBox2上的所有控件 { if (control is System.Windows.Forms.PictureBox) { System.Windows.Forms.PictureBox pb = (System.Windows.Forms.PictureBox)control; pb.AllowDrop = true; } if

JS完成页面跳转并传参的方法|附加:循环遍历对象

此方法只能传递较少参数 方法如下: <a href='page/index.html'>跳转</a> 以上是正常写法,如果要传参按一下写法: <!--参数写在?后面,多个参数用&隔开,下面传的参数为name=lemon,age=18--> <a href='page/index.html?name=lemon&age=18'></a> 当跳转到页面的时候这个页面的地址栏就会跟你写的那个一样,这时候你只需要获取地址栏的内容并进行采取

Java:集合for高级循环遍历

增强for循环: 格式:for(变量数据类型 要遍历的变量 :元素所在数组(集合)名称) 也即 for(Type element: array或collection) 使用foreach遍历集合: 只能获取集合中的元素,不能对集合进行操作. 而迭代器Iterator除了可以遍历,还可以对集合中的元素遍历时进行remove操作. 如果使用ListIterator还可以在遍历过程中进行增删改查的动作. //例子1: import java.util.*; class Foreach { public

Android中List循环遍历性能对比

在android开发中只要是列表式风格界面我们几乎都需要用到List来存放数据,在数量很少的List的话几乎任何一种循环遍历方式整体性能都无差别,但是当我们遇到数据量稍大的时候有必要考虑用哪种方式写起来比较高性能. 常见的有以下三种: 第一种 for (String s : tests) { // .... } 第二种 int size = tests.size(); for (int i = 0; i < size; i++) { tests.get(i); } 第三种 Iterator<S

javascript增加Array的each方法 循环遍历多维数组

由于ECMA提供遍历数组的方法forEach()只能遍历一维数组,没有提供循环遍历多维数组的方法,所以我们自己来实现一个each()方法,来遍历多维数组. <script charset=utf-8 type=text/javascript> /*var arr = [1,2,3,[4,[5]]]; arr.forEach(function(item,index,arr){ alert(item); }); */ //模拟ECMA forEach  循环遍历多维数组 var arr = [1,