Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 01 Jul 2004 @ 18:22:58 GMT


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


Subj:   Re: Aiii, INTERVALs!
 
From:   Frank C. Martinez IV

Hello!

Well, the first one:

     SELECT  (run_end - run_start HOUR TO MINUTE)
             + CAST ( (EXTRACT ( SECOND FROM (run_end - run_start HOUR TO SECOND))
                   (DECIMAL(5,1))) AS INTERVAL SECOND(1) )
       FROM dp.t_canary
       SAMPLE 1;

rounds properly, but doesn't change the output to get rid of the trailing zeros:

     (((Run_End - Run_Start) HOUR TO MINUTE+EXTRACT(SECOND FROM (R
       0:00:08.000000

However, the second variation:

     SELECT  ( EXTRACT ( SECOND FROM (run_end - run_start HOUR TO SECOND) / 3600)
              * 3600 (DECIMAL(9,1)) )
              * CAST ( '00:00:01.0' AS INTERVAL HOUR(2) TO SECOND(1))
       FROM dp.t_canary
       SAMPLE 1;

does what I want:

     ((EXTRACT(SECOND FROM ((Run_End - Run_Start) HOUR TO SECOND/
         0:00:03.9

Thank you. But don't you feel this is a lot of trouble for something that with an ordinary datatype could be accomplished by a FORMAT statement? Or am I missing something? Well, I was given a gift certificate, good for ONE (1) LOBOTOMY last Christmas. Anyway, thanks for the help.


iv



     
  <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