title: Are a CASE statement and a DECODE equivalent?
body: <p>It seems like the simple CASE expression and the DECODE function are equivalent and that the results returned by them should be identical. Are they?</p>
  
  <p>The documentation has the following to say about the <a href="http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/fundamentals.htm#CHDJCCGI" rel="noreferrer">simple CASE expression</a>:</p>
  
  <blockquote>
    <p>The simple CASE expression returns the first result for which
    selector_value matches selector. Remaining expressions are not
    evaluated. If no selector_value matches selector, the CASE expression
    returns else_result if it exists and NULL otherwise.</p>
  </blockquote>
  
  <p>Comparing this to the <a href="http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions049.htm#SQLRF00631" rel="noreferrer">DECODE function</a>, the descriptions seem to be identical.</p>
  
  <blockquote>
    <p>DECODE compares expr to each search value one by one. If expr is equal
    to a search, then Oracle Database returns the corresponding result. If
    no match is found, then Oracle returns default. If default is omitted,
    then Oracle returns null.</p>
  </blockquote>
  
  <p>As the <a href="http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/fundamentals.htm#LNPLS281" rel="noreferrer">searched CASE expression</a> can be equivalent to the simple, this could be construed to be the same as well.</p>
  
  <p>These three statements all seem to return the same result, 0.</p>
  
  <pre><code>select case 1 when 2 then null else 0 end as simple_case
       , case when 1 = 2 then null else 0 end as searched_case
       , decode(1, 2, null, 0) as decode
    from dual
  </code></pre>
  
  <p>Do the simple CASE expression and the DECODE function (and in specific circumstances the searched CASE expression) always return the same result?</p>