title: Execution order of WHEN clauses in a CASE statement
body: <p>Given the following body of a case statement:</p>
  
  <pre><code>1    WHEN r.code= '00'                        then 'A1'
  2    WHEN r.code ='01' AND r.source = 'PXWeb' then 'A2'   &lt;
  3    WHEN r.code ='0120'                      then 'A3'
  4    WHEN r.code ='01'                        then 'A4'   &lt;
  5    WHEN r.code ='1560'                      then 'A5'
  6    WHEN r.code ='1530'                      then 'A6'
  7    WHEN r.code ='1550'                      then 'A7'
  </code></pre>
  
  <p>I'm assuming line 2 will always execute before line 4?  Then I read statements like '<em>SQL is a declarative language, meaning that it tells the SQL engine what to do, not how</em>' in</p>
  
  <p><a href="https://stackoverflow.com/questions/4596467/order-of-execution-of-the-query">Order Of Execution of the SQL query</a></p>
  
  <p>and wonder if this also relates to the order of execution in the CASE statement.  Essentially, can i leave the code above as it is without having to change line 4 to </p>
  
  <pre><code>4    WHEN r.code ='01' AND r.source != 'PXWeb' then 'A4'   
  </code></pre>