Use for loop after the With Clause in PL/SQL
<p>Im using PL/SQL. I am trying to have a for loop right after I define my temporary tables in the with clause. However, Im getting an error to have a SELECT query first.</p>

<p>For instance</p>

<pre><code>WITH TMP1 AS (.....), TMP2 AS (......), TMP3 AS (......)

FOR R IN (SELECT DISTINCT ..... FROM TMP1 WHERE .....)
LOOP
SELECT .... FROM TMP2, TMP2 WHERE TMP2.... = R..... ....
</code></pre>

<p>How do I go about doing so?</p>

<p>Thanks</p>