select * from t where t.栏位1=decode(in_a,null,t.栏位1,in_a) and t.栏位2=decode(in_b,null,t.栏位2,in_b)

解决方案 »

  1.   


    select * from t where t.栏位1=decode(in_a,null,t.栏位1,in_a) and t.栏位2=decode(in_b,null,t.栏位2,in_b)
    也可能 栏位1 like '%in_a%', 所以用decode??
      

  2.   

    2描述和1对比有模糊的,1楼的要不能解决就老老实实用动态SQL组合条件吧
      

  3.   

     and(栏位1=in_a or in_a is null)
      

  4.   


    1 (栏位1=in_a or in_a is null) and (栏位2=in_b or in_b is null)
      

  5.   

    select
    *
    from tables
    where (in_a is not null and 栏位1 = in_a) 
    and (in_b is not null and 栏位2  = in_b)