title: Dynamic SQL (EXECUTE) as condition for IF statement
body: <p>I want to execute a dynamic SQL statement, with its returned value being the conditional for an <code>IF</code> statement:</p>
  
  <pre><code>IF EXECUTE 'EXISTS (SELECT 1 FROM mytable)' THEN
  </code></pre>
  
  <p>This generates the error <code>ERROR:  type "execute" does not exist</code>.</p>
  
  <p>Is it possible to do this, or is it necessary to execute the SQL before the IF statement into a variable, and then check the variable as the conditional?</p>