Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 19 Jun 2003 @ 19:14:18 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: Performance Analyze
 
From:   Dennis Calkins

On Wed, 18 Jun 2003 11:35:15 -0500, Geoffrey Rommel wrote:

  DATE_ARRT_INFO >= date '2003-06-01' - INTERVAL '6' MONTH  


  /* another way of saying the same thing: */  


  DATE_ARRT_INFO >= add_months(date '2003-06-01', -6)  



Hi,

Intervals may not handle month calculations correctly.

If you do

date '2003-08-30' - INTERVAL '6' MONTH


It will generate 2003-02-30 which is an invalid date and the query will fail.

The second suggestion

add_months


is a TERADATA extension to the ANSI standard. It doesn't suffer from this because Teradata defined it to handle this correctly by reverting the invalid date to the closest valid date. Therefore for my example

add_months(date '2003-08-30',-6)


would give 2003-02-28 which is valid and the query will work.



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