title: ORA-30076 when trying to find days between dates
body: <p>I was trying to find the no of days between 2 dates.
  I tried running the below query and ended up with <strong>ORA-30076</strong> error.</p>
  
  <p>Query is,</p>
  
  <pre><code>select extract(day from (sysdate - to_date('2009-10-01', 'yyyy-mm-dd'))) 
   from dual
  </code></pre>
  
  <p>Error is,</p>
  
  <pre><code>Error at Command Line:1 Column:34
  Error report:
  SQL Error: ORA-30076: invalid extract field for extract source
  30076. 00000 -  "invalid extract field for extract source"
  *Cause:    The extract source does not contain the specified extract field.
  </code></pre>
  
  <p>But when i try to run</p>
  
  <pre><code>Select extract(day from sysdate) from dual;
  </code></pre>
  
  <p>i got correct output.</p>
  
  <p>Please help if anyone knows the reason as why i am getting the above error.</p>