Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 30 Oct 2012 @ 09:18:59 GMT


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


Subj:   Re: OVERLAPS question
 
From:   td newsgroup

  The OVERLAPS function returns "true" only when the entire first range is "inside" the second range.  


I am not sure about that;

     SEL
         CASE
             WHEN ( CAST('2012-02-22' AS DATE FORMAT 'YYYY-MM-DD')
                   ,CAST('2012-02-25' AS DATE FORMAT 'YYYY-MM-DD') )
             OVERLAPS
                   ( CAST('2012-02-24' AS DATE FORMAT 'YYYY-MM-DD')
                    ,CAST('2012-10-24' AS DATE FORMAT 'YYYY-MM-DD') )
         THEN 'Overlaps'
         ELSE 'Doesnt Overlap'
         END ;

gives Overlaps as we expect...

Consider that for (s1,e1) the e1 is not part of the period - as it is true for period data types.

-> first example '2012-02-23' does not overlap '2012-02-24' - '2012-10-23'

-> but second example '2012-02-24' does not overlap '2012-02-24' - '2012-10-23'

The interesting part is that

     period( CAST('2012-02-24' AS DATE FORMAT 'YYYY-MM-DD')
                 ,CAST('2012-02-24' AS DATE FORMAT 'YYYY-MM-DD') ) is not valid ;->...

shall we call it a feature...


Ulrich



     
  <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