Thursday, March 30, 2017

Convert Julian date to Calendar date PL SQL Oracle


select YADOB DOB,
CASE
when YADOB = 0 Then  TO_CHAR(TO_DATE(SUBSTR (YADOB,2,5),'YYDDD'),'YYYY-MM-DD')
when YADOB < 100000 Then   TO_CHAR(TO_DATE(YADOB+1900000, 'YYDDD'), 'MM/DD/YYYY')
when YADOB > 100000 Then  TO_CHAR(TO_DATE(YADOB+1900000, 'YYDDD'), 'MM/DD/YYYY')
ELSE   '0'   end JulianDT
   from proddta.F060116

By Shyamini Nair
 

No comments: