title: ORA-21780: Maximum number of object durations exceeded
body: <p>There are 20 tables  (table_id from 1 to 20) whose count needs to be taken and updated in DATA_COUNT.REC_CNT_ACTUAL(tablename.coumnname).  </p>
  
  <p>For 13 tables the count update is successful. Then this error pops up. </p>
  
  <p>Initially I wrote the below as a procedure by passing table_id and table_name. The procedure was called continously 20 times. I though that might be the reason for error: ORA-21780: Maximum number of object durations exceeded.</p>
  
  <p>Then I removed that procedure .  
  Now these 20 update statements are in 20 different places across the package. Still same error. Please help me understand the issue or suggest an alternative. </p>
  
  <pre><code>UPDATE DATA_COUNT
  SET REC_CNT_ACTUAL=
    (SELECT COUNT(1) FROM TITLE
    )
  WHERE TABLE_ID =20;
  
  </code></pre>
  
  <p>Below is the procedure that was used:</p>
  
  <pre><code>
  PROCEDURE DELETE_COUNT(
      PI_TABLE_ID   IN NUMBER,
      pi_table_name IN VARCHAR2)
  AS
    pragma autonomous_transaction;
    V_SQLERRM    VARCHAR2(4000) := NULL;
    V_SQLERRCODE VARCHAR2(50)   := NULL;
    V_CNT        NUMBER;
    V_SQL        varchar2(4000);
  
  BEGIN
    V_SQL:='select COUNT(1) from '|| PI_TABLE_NAME;
    EXECUTE immediate V_SQL INTO v_cnt;
    UPDATE DATA_COUNT
    SET REC_CNT_ACTUAL=v_cnt
    where TABLE_ID    =PI_TABLE_ID;
  
    commit;
  
  EXCEPTION
  WHEN OTHERS THEN
    ROLLBACK;
    v_sqlerrm    := SUBSTR(sqlerrm,1,255);
    v_sqlerrcode := SQLCODE;
    /*Log error*/
    datareduction_run_log (-20001, 'procedure DELETE_COUNT', CURRENT_TIMESTAMP, 'FAILED', 'Error in procedure DELETE_COUNT. Error Number:'||v_sqlerrcode||'-Error Msg:'||v_sqlerrm||'- backtrace - ' || dbms_utility.format_error_backtrace, SYSDATE, USER, NULL, NULL );
    RAISE_APPLICATION_ERROR(   -20001,'Unexpected Error: Error Number:'||V_SQLERRCODE||'-Error Msg:'||V_SQLERRM||'- backtrace - ' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
  END DELETE_COUNT;
  
  </code></pre>