1 2 3 4 5 6 7 8 9
| select
benf_dd_admis_ben,
case when extract(month from benf_dd_admis_ben) < 4
then cast('2011-' || cast(cast(extract(month from benf_dd_admis_ben) as format '99') as char(2)) || '-' || cast(cast(extract(day from benf_dd_admis_ben) as format '99') as char(2)) as date format 'YYYY-MM-DD')
else cast('2010-' || cast(cast(extract(month from benf_dd_admis_ben) as format '99') as char(2)) || '-' || cast(cast(extract(day from benf_dd_admis_ben) as format '99') as char(2)) as date format 'YYYY-MM-DD')
end ANNIV
from V_ADMIS_BEN
where benf_cod_situ_admis between 156 and 159
order by 1,2; |