title: ora-02393 exceed limit on call cpu usage (Oracle) - how to workaround
body: <p>I have function which calcs the IRR (Internal Rate of Return) for specific contract ..</p>
  
  <p>This function is called inside simple procedure and is applied to all contracts in defined table ..</p>
  
  <p>problem is, that there is a roughly 200k rows which needs to be updated .. and the function calc_IRR() is not so effective (loop and sub-loop), which is necessary to calc the correct value ..</p>
  
  <p>After an hour of run, query will exceed the CALL CPU USAGE limit (ora-02393) and the query ends.. but I need to re-run the query again ...</p>
  
  <p>Here comes the procedure:</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE proc_set_irr ( p_table_name IN VARCHAR2, p_cashflow_column IN VARCHAR2, p_dimension IN VARCHAR2, p_irr_column IN VARCHAR2 )  
  IS
  
     v_data VARCHAR2(2000);
     v_updt VARCHAR2(2000);
     v_condition VARCHAR2(2000);
     v_irr NUMBER;
     c1 SYS_REFCURSOR;
  
  BEGIN  
      -- fetch each dimension data separately
      OPEN c1 FOR 'SELECT distinct '||p_dimension||' FROM '||p_table_name||' WHERE 1=1 AND '||p_irr_column||' IS NULL'; 
  
      LOOP  
  
        FETCH c1 INTO v_data;
        EXIT WHEN c1%NOTFOUND;   
  
              v_condition := p_dimension || ' = ' || v_data; -- build condition for IRR calculation
  
              v_irr := f_calc_irr(p_table_name, p_cashflow_column, v_condition)*100;   -- calc IRR for defined contract      
  
              v_updt := 'UPDATE '||p_table_name||' SET '||p_irr_column||' = :1 WHERE '||p_dimension||' = :2'; -- build UDPATE query for contract
  
              EXECUTE IMMEDIATE v_updt USING v_irr, v_data; -- update contract with IRR
  
              COMMIT;
  
      END LOOP;
  
      EXCEPTION
          WHEN OTHERS THEN
             raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
  
  END proc_set_irr;
  /
  </code></pre>
  
  <p>How to do it without manual input of user? I have it in PACKAGE so it's called automatically once a month ... </p>