sql - Oracle case inside where clause -
this simple question, i've read details using case
in where
clause, couldn't able make clear idea how use it. below sample query:
1 select * dual 2 (1 =1) 3 , (sysdate+1 > sysdate) 4 , (30 > 40) 5 , (25 < 35);
i have procedure i_value
in parameter. need ignore 4th line if i_value 's' , need ignore 5th line if i_value 't'.
thanks in advance.
i think best way solve problem:
select * dual (1 = 1) , (sysdate + 1 > sysdate) , case when i_value = 's' case when (25 < 35) 1 else 0 end when i_value = 't' case when (30 > 40) 1 else 0 end end = 1;
of course, use dynamic sql, it'd more difficulty , less effectively.
Comments
Post a Comment