title: PostgreSQL CASE usage in functions
body: <p>Can't we use <code>CASE</code> condition outside SQL <code>SELECT</code> statements?</p>
  
  <p>E.g.:</p>
  
  <pre><code>CASE 
    WHEN old.applies_to = 'admin' THEN _applies_to = 'My Self'
    ELSE _applies_to = initcap(old.applies_to)
  END
   _summary = _summary || '&lt;li&gt;Apply To: ' || _applies_to || '&lt;/li&gt;';
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>ERROR:  syntax error at or near "_summary"
  LINE 86: _summary = _summary || '&lt;li&gt;Apply To: ' || _applies ...
  </code></pre>