title: case statement in where clause with in values oracle sql
body: <p>I am working on Oracle Apex application. I have a simple select query which is working fine but now I want to do if/else or case statement in that query.</p>
  
  <p>so query is below</p>
  
  <pre><code>select value d,
         id r
    from dhm_lov_data
   where lov_id = 103
     and nvl(isdeleted,0) = 0
     and parentid_1 =:p21_typeid
   order by d
  </code></pre>
  
  <p>I want to change this query to add a condition on <code>:P21_TYPEID</code> value.
  E.g. if <code>:P21_TYPEID</code> value is 1 then in where clause it should be <code>PARENTID_1 in (10,11)</code>
  otherwise <code>PARENTID_1 = :P21_TYPEID</code>.</p>
  
  <p>I tried to put it in case statement but it didn't work. Below is query I am trying to make work using a case statement</p>
  
  <pre><code>SELECT  VALUE d, id r FROM DHM_LOV_DATA WHERE LOV_ID= 103 and nvl(ISDELETED,0) = 0  
  and 
  case when :P21_TYPEID = 848 then PARENTID_1 in (287,288)
      else PARENTID_1 = :P21_TYPEID  end;
  order by d
  </code></pre>