create or replace function numberToDate(i_date in number)
return date
is
v_date number;
result date ;
begin
v_date := i_date;
if v_date = 0 then
v_date := null;
end if;
result := TO_DATE(v_date, 'J');
return result;
end numberToDate;