title: oracle sql clarification to use case condition in where clause, error sdo_nn cannot be evaluated without an index
body: <p>I am using oracle 11g with oracle spatial, this query works if I use distance as below in the where condition</p>
  
  <pre><code>mdsys.sdo_nn ( b1.location, l_location , 'SDO_BATCH_SIZE=100 distance='|| 
  c1.tier_radius||' unit=KM', 1) = 'TRUE'
  </code></pre>
  
  <p>however I want the distance evaluated based on condition. Below query gives error sdo_nn cannot be evaluated without an index, I want distance to be evaluated based on condition something like this </p>
  
  <pre><code>select
          /*+ first_rows LEADING(c) USE_NL(c1 b1) INDEX(b1 BRANCH_LOCATION_SPIX)*/
          b1.BRANCH_ID,
          mdsys.sdo_nn_distance(1) branchDistance
        from
          branch b1, city c1
        where
          mdsys.sdo_nn ( b1.location, l_location , 'SDO_BATCH_SIZE=100 distance='|| (case  when b1.restaurant_id not in (3970,3971,3972) then c1.tier_radius
          else 15 end) ||' unit=KM', 1) = 'TRUE'   
          and b1.city_id = c1.city_id  
  </code></pre>