oracle case when 多条件控制语句
RT
oracle数据库中
已知 :
select  
     t.a,
     t.b
  from  
    table1 t , table2 t2
where  
    t.c=t2.c and
    t.d =
    case ¶m='01' then '1'   --想在此处多加一条语句。像这样: case ¶m ='01' then t.d='1' and t.e='1' .但这样写 编译不通过。尝试用if 语句 编译也通不过。现在需要这样的逻辑判断,请问各位大侠该如何实现啊
    case ¶m ='02' then '2'
  end case  
   and t.f = 0;
问题描述完毕。
简单来说就是想做这样的判断,当参数为01的时候,想让t.d='1' 并且 and t.e='1' 。
当参数为02的时候。想让t.d='2'并且 and t.e='2'.
------解决方案--------------------
SQL code
--楼主是不是想要这个样子
select  
  t.a,
  t.b
 from  
  table1 t , table2 t2
where  
  t.c=t2.c and
  t.d = decode(¶m,'01','1','02','2')
and t.e=decode(¶m,'01','1','02','2')