|
|
Archives of the TeradataForum
Message Posted: Tue, 13 May 2008 @ 16:01:52 GMT
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))
| |