Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 18 May 2005 @ 14:08:37 GMT


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


Subj:   Re: Calculate TIMESTAMP difference
 
From:   Maxwell, Donald

When you subtract two timestamps, you must declare the resulting INTERVAL datatype, ie.

     SELECT  ctime - c DAY(4) TO SECOND

Therefore, your where clause should be:

     WHERE   (INTERVAL '30' SECOND < ctime - c DAY(4) TO SECOND )

Alternatively, you could say:

   WHERE   c < CURRENT_TIMESTAMP - INTERVAL '30' SECOND

This last alternative is probably your best option because it will never overflow, and you don't need the declared variable.


Donald Maxwell



     
  <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