Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Wed, 26 May 2004 @ 15:52:53 GMT

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

Subj:   Re: Substract 1 year from leap year - bug?
From:   Mirjam Berger


This is actually working as designed. I remember that I was pretty upset too the first time it bit me. But if you read some of the text provided to the add_months function in the manual it all starts to make sense.

Because unlike my initial belief, it's not selfevident that

     '2004-03-31' - Interval '1' Month should return

It's really a question of what your application needs if returning the last day of the previous month (in the scenario above) is acceptable or not. IF you find that this beavior is satisfactory for your application you can use the ADD_Month function.

If not you have to decide how to handle the specific problems you want to solve. So -Interval '1' Month erroring out on you is a way for the RDBMS to tell you that there is a problem with your code, that you have to handle in some manner :)



  <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: 23 Jun 2019