I have the following Case statement that I need to translate in a Stage Variable
Code: Select all
case
when substr(in_date_numeric, 7, 2) between '01' and
to_char(last_day(to_date(substr(in_date_numeric, 1, 6),
'YYYYMM')),
'DD')
then
to_date(in_date_numeric, 'YYYYMMDD')
else
null
end
else
null
end in_date
So far I manage to get something like that:
If string(in_date_numeric, 1, 4) between '0001' and '9999' and string(in_date_numeric, 5, 2) between '01' and '12'
then
(If string(in_date_numeric, 7, 2) between '01' and char(last_day(iconv(string(in_date_numeric, 1, 6),'YYYYMM')),'DD')
then iconv(in_date_numeric, 'YYYYMMDD') else null )
else null
I am not sure how the function last_day from Oracle will work in DataStage. Is something equivalent that can be used?
Thanks for your help