title: Can I join to a table in ORACLE (10g) using a CASE clause in the ON statement (or even where clause as it's an inner join)
body: <p>I'm trying to make the following code smaller.  Is this possible?</p>
  
  <pre><code>select a.*
  from table1 a
  WHERE a."cola1" = 'valuea1'
  UNION ALL
  select a.*
  from tablea1 a
  inner join tablea2 b on a."cola2" = b."colb2"
  WHERE a."cola1" = 'valuea2'
    and b."colb3" = 'valueb3'
  </code></pre>
  
  <p>In effect I'm looking for records from table1 for value1 or value2, but for records matching value2 I want to apply 1 extra condition which involves a join to a 2nd table
  Can this be done without a UNION clause?</p>
  
  <p>A skeleton or what I'm trying to code is below....but it's not working naturally.</p>
  
  <pre><code>select a.*
  from table1 a
  inner join table2 b on a."cola1" = b."COLb1"
  WHERE a."cola2" IN ('valuea1','valuea2')
    and 
    CASE 
      WHEN a."cola2" = 'valuea2' THEN b."colb1" = 'valueb3'
      ELSE 1=1
    END CASE
  </code></pre>