select 语句
判断比如a=1时执行 select b from TABLE
a=2是执行 select c from TABLE 
咋写,求指导

解决方案 »

  1.   

    这个必需是语句块吧
    if xxx then
    elseend if;
      

  2.   

    为什么会有这么古怪的需求? 如果是ibatis里面的话,完全可以写两个select标签,分别查询,然后在serviceImp里面进行逻辑判断。
      

  3.   

    select case
             when a = 1 then
              b
             when a = 2 then
              c
             else
              null
           end case
      from TABLE
    如果a即不等于1也不等于2,则为null
      

  4.   

    代码当中判断a等于不同值时,执行不同的SQL
      

  5.   

    SQL写不出来就试试在CTRL里面用逻辑判断啊
      

  6.   

    select decode(a, 1, t.b, 2, t.c) from test t;