title: Get value from anonymous block inside a procedure in oracle
body: <p>I have created a stored procedure which calls a function which returns boolean.</p>
  
  <p>We are getting the schema name the function is under at run time, so we are creating the statement as a string by concatenation, and executing the function in an anonymous block dynamically.</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE usp_proc
  (
          variable declarations
  )
  as
  var1 varchar2(50);
  var2 varchar2(50);
  var3 varchar3(50);
  begin
      execute immediate
          'declare result boolean ; ConversionFactor number; res varchar2(10); begin  result:= '||schemaname||'fn_name('''||var1||''', '''||var2||''',ConversionFactor,'''||var3||''');'||
                      ' if(result=False) then res:=''False'';'||
                      ' ELSE res:=''True''; END IF; end;';
  
      stmt:='select Weight*ConversionFactor  from table'
         Open cur for stmt;   
      END;
  </code></pre>
  
  <p>I need to use the <code>ConversionFactor</code> variable outside the anonymous block. How can I gets its value to use later in the procedure?</p>