Using EXECUTE_IMMEDIATE to call a sub procedure
<p>I have a function which has several sub-procedures inside it:</p>

<pre><code>  create function func1 return varchar2
    v_string varchar2(100);
    proc1;
    proc2;
    proc3;        
  begin
    v_string := 'proc' || '1';   --- trying to make it simple
    execute immediate 'BEGIN '|| v_string ||'; END;';
    ...
</code></pre>

<p>Directly calling the sub-procedures does work; but I have dozens of sub-procedures - so I form a string variable with the 'proc' name and try to dynamically execute it in a loop.</p>

<p>When I do that I get an error - 'proc1' must be declared.</p>

<p>Is there a way to achieve this?</p>