title: avg time oracle sql
body: <p>I'm trying to find the avg start time for a date range but the avg function doesn't seem to work on <code>to_char(cast(Start_Dt as date),'HH24:MI')</code> (Start_Dt sample: <code>12/12/18 02:30:13</code>). Any ideas on how I can get my desired result?</p>
  
  <p>sample:</p>
  
  <pre><code>SELECT
  job_nm
  avg(to_char(cast(Start_Dt as date),'HH24:MI'))
  FROM batch_table
  Where Start_Dt &gt;= trunc(sysdate-10)
  group by job_nm
  </code></pre>
  
  <blockquote>
    <p>Error: ORA-01722: invalid number
    01722. 00000 -  "invalid number"
    *Cause:    The specified number was invalid.
    *Action:   Specify a valid number.</p>
  </blockquote>
  
  <p>Ideal results would be 
  the query only looks at jobs ran in the last 10 days and the average start time for the period.
  <br>
  desired results:</p>
  
  <pre><code> JOB_NM | AVG Time
      open   |  2:30
      close  |  3:30
  </code></pre>