Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Thu, 01 Nov 2001 @ 19:12:08 GMT

  <Prev Next>  
Next> Last>>  

Subj:   Teradata and ANSI Date INTERVAL
From:   Dara Tressler

Does anyone know why the INTERVAL function used in the SQL statement below does not work (I know that I can use ADD_MONTHS to achieve this but it seems unreasonable that this would generate an error):

select ('10/31/2001' (date, format 'MM/DD/YYYY')) - INTERVAL '13' MONTH

This is the error generated:

Code = 2665.
2665: Invalid date.

This does not generate an error:

select Add_Months(('10/31/2001' (date, format 'MM/DD/YYYY')), -13)

It would seem by the documentation that this bug was included as a "FEATURE" of ANSI SQL 99. It occurs when you are on the 31st day of a month and are going back or forward to a date with only 30 days. What kind of mathematical error would cause this??? Is there any was other than ADD_MONTHS which would NOT cause an error?


Dara Tressler

  <Prev Next>  
Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020