title: Difference in Date between Oracle and Teradata
body: <p>I ran into a strange problem while calculating the difference between two dates in Oracle(11.2.0.3.0) and Teradata(13.10.07.15).
  NLS_CALENDAR parameter in Oracle is set to GREGORIAN.</p>
  
  <pre><code>Oracle                                                              Teradata
  ------------------------------------------------------------------------------------------------------------
  select trunc(sysdate) - date'1800-01-01' diff from dual;            select date - date'1800-01-01' diff;    
  
  DIFF                                                                diff    
  ----------                                                          ----------- 
  78224                                                               78224
  </code></pre>
  
  <p>No difference so far.</p>
  
  <pre><code>select trunc(sysdate) - date'1500-01-01' diff from dual;            select date - date'1500-01-01' diff;
  
  DIFF                                                                diff
  ----------                                                          -----------
  187788                                                              187797
  </code></pre>
  
  <p>Difference of 9 days.</p>
  
  <pre><code>select trunc(sysdate) - date'1000-01-01' diff from dual;            select date - date'1000-01-01' diff;
  
        DIFF                                                          diff
  ----------                                                          -----------
      370413                                                          370418
  </code></pre>
  
  <p>Difference of 5 days.</p>
  
  <pre><code>select trunc(sysdate) - date'0500-01-01' diff from dual;            select date - date'0500-01-01' diff;
  
        DIFF                                                          diff
  ----------                                                          -----------
      553038                                                          553039
  </code></pre>
  
  <p>Difference of 1 day.</p>
  
  <pre><code>select trunc(sysdate) - date'0001-01-01' diff from dual;            select date - date'0001-01-01' diff;
  
        DIFF                                                          diff
  ----------                                                          -----------
      735297                                                          735295
  </code></pre>
  
  <p>Difference of 2 days.</p>
  
  <p>Does anyone know why this difference?</p>