title: How to find Ref Cursor execution time in procedure?
body: <p>I'm using Ref Cursor as output parameter for PLSQL Procedure. I need to maintain the exact start and end time of proc in log table.</p>
  
  <p><strong>The dummy code below:</strong></p>
  
  <pre><code>Procedure(P1 IN NUMBER, P_REF_CUR OUT SYS_REFCURSOR)
  IS
  V_TS TIMESTAMP;
  BEGIN
  V_TS := SYSTIMESTAMP;
  &lt;Business logic here to generate SELECT query for Ref Cursor...&gt;;
  
  OPEN P_REF_CUR FOR &lt;SELECT QUERY&gt;;
  
  INSERT INTO LOG_TABLE(ID, STR_TIME,END_TIME,..) VALUES 
  (1,V_TS,SYSTIMESTAMP,...);
  END;
  </code></pre>
  
  <p>The select query for Ref Cursor sometimes takes 2-3 mins to execute but in log table I see the difference between STR_TIME and END_TIME as only few seconds.</p>
  
  <p>How can I capture the total time taken by procedure including the query execution time?</p>