number类型转date类型

遇到用数字记录日期时,进行查询转换。

create or replace function num_to_date(s in number) return date
is
begin
return to_date('1970-01-01 08:00:00','YYYY-MM-DD HH24:MI:SS')+(s/86400);
end;
/

 

 

select num_to_date(xxxxx) from dual;

 

posted @ 2020-06-11 16:44  咿呀咿呀哟9614  阅读(780)  评论(0)    收藏  举报