title: Oracle PL/SQL for loop: select query depending on condition
body: <p>I have a procedure body with a loop on the results of a query:</p>
  
  <pre><code>for src in (
      /* query A */
  ) loop
      /* 
       * loop body...
       */
  end loop;
  </code></pre>
  
  <p>But I need to select between two or more different 'query A's depending on some condition. The queries are very different, but they all have the same resulting shape, namely one number column.</p>
  
  <p>Is there a way to avoid having to repeat the loop code? Can I do something like this?</p>
  
  <pre><code>if /* some condition */ then
      query_A := /* ... */;
  else
      query_A := /* ... */;
  end if;
  
  for src in (query_A) loop
      /* 
       * loop body...
       */
  end loop;
  </code></pre>
  
  <p>I'm on Oracle 11g</p>