Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 13 May 2008 @ 16:01:52 GMT


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


Subj:   Re: Need help to convert Oracle code to Teradata
 
From:   Geoffrey Rommel

          > (TO_CHAR(TO_DATE(lpad(decode(column_name,0,1900001,
          > column_name),7,0), 'YYYYDDD') ,'YYYYMM')

     decode(column_name,0,1900001,column_name)

This replaces zero values with 1900001. In Teradata:

     case
       when column_name = 0 then date '1900-01-01'
       else column_name
     end

The rest of the expression simply changes the date to a 'YYYYMM' format.

     cast(cast(case ... end as format 'YYYYMMDD') as char(6))


     
  <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