计算oracle数据库字符串时间秒差值

前端之家收集整理的这篇文章主要介绍了计算oracle数据库字符串时间秒差值前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1 原始数据


select t.record_date as rq,

t.cal_current_status as curZT,
round(to_number(to_date(to_char(t.cal_current_end_time,
'yyyy/mm/dd hh24:mi:ss'),
'yyyy/mm/dd hh24:mi:ss') -
to_date(to_char(t.cal_current_begin_time,
'yyyy/mm/dd hh24:mi:ss')) * 24 * 60,
2) as curTime,
t.cal_series_status as serzt,
round(to_number(to_date(to_char(t.cal_series_end_time,
'yyyy/mm/dd hh24:mi:ss') -
to_date(to_char(t.cal_series_begin_time,
2) as serTime
from tb_lh_ug_import_status t

order by record_Date

2 格式化后数据

3 *24代表求小时差,*24*60代表求分钟差,*24*60*60代表求秒差

select to_number(to_Date('2017/8/4 0:04:14','yyyy/mm/dd hh24:mi:ss')-to_Date('2017/8/4 0:03:17','yyyy/mm/dd hh24:mi:ss'))*24*60*60 from dual;

原文链接:https://www.f2er.com/oracle/208243.html

猜你在找的Oracle相关文章