title: SQL exception for comparing operation in WHERE clause
body: <p>I have these 2 tables joined up and i made a statement that period has to be > 2013.10.01. But i want this statement ineffective for fields where code='A722' and host_country='Poland'. I tried using case statement in where clause, but it doesn't seem to be working and i can't seem to figure out why. Any alternatives for this? </p>
  
  <pre><code>with table1 (person_id, period) as (
     select 12, date '2013-08-01' from dual union all
     select 13, date '2015-03-16' from dual union all
     select 14, date '2015-04-22' from dual union all
     select 15, date '2015-06-13' from dual
   ),
   table2 (person_id, code, host_country) as (
     select 12, 'A8722', 'poland' from dual union all
     select 13, 'B8422', 'china' from dual union all
     select 14, 'Z8725', 'sweden' from dual union all
     select 15, 'G8726' ,'Germany' from dual
   ) 
  
   select 
   t1.person_id, 
   t2.code, 
   t2.host_country,
   t1.period 
   from table1 t1, table2 t2 
   where t1.person_id=t2.person_id
   AND t1.period&gt; CASE WHEN t2.code NOT IN ('A8722') AND t2.host_country NOT IN('poland') THEN to_date('2013.10.01','YYYY.MM.DD') END
  </code></pre>
  
  <p>Link to <a href="http://sqlfiddle.com/#!4/9eecb7d/4813/0" rel="nofollow">sqlfiddle</a>.</p>