title: Syntax error in SQL (IF / EXISTS / CASE / THEN)
body: <p>I have a logging table where I need to insert the status and remark based on the condition below.   </p>
  
  <pre><code>IF EXISTS (SELECT CASE
      WHEN COUNT(A)=COUNT(*))
      THEN --  table has no issues
          STATUS := 'C'
          REMARKS := 'Procedure Completed'
      ELSE -- table has issues
          STATUS := 'F'
          REMARKS := 'Validation Failed'
          END
          FROM table x;
      END IF;
  </code></pre>
  
  <p>On executing this I am facing an error :</p>
  
  <pre><code>'SELECT  EXISTS (SELECT CASE WHEN COUNT(dISTINCT A)=COUNT(*))'
  error found ")" (at char 75) expecting `AND' or `AT' or `BETWEEN' or `IN' or `IS'
  </code></pre>
  
  <p>Note:-This process is a part of a store procedure in NETEZZA</p>