当前位置:Gxlcms > 数据库问题 > oracle计算两个时间的差值(XX天XX时XX分XX秒)

oracle计算两个时间的差值(XX天XX时XX分XX秒)

时间:2021-07-01 10:21:17 帮助过:4人阅读

OR REPLACE FUNCTION F_GET_DIFF_TIME(START_TIME IN DATE, END_TIME IN DATE) RETURN VARCHAR2 IS DIFF_TIME VARCHAR2(50); BEGIN SELECT TDAY || || THOUR || || TMINUTE || || ROUND((TT - TMINUTE) * 60) || INTO DIFF_TIME FROM (SELECT TDAY, THOUR, TRUNC((TT - THOUR) * 60) TMINUTE, (TT - THOUR) * 60 TT FROM (SELECT TDAY, TRUNC((TT - TDAY) * 24) THOUR, (TT - TDAY) * 24 TT FROM (SELECT TO_NUMBER(END_TIME - START_TIME) AS TT, TRUNC(TO_NUMBER(END_TIME - START_TIME)) AS TDAY FROM (SELECT START_TIME, END_TIME FROM dual)))); RETURN DIFF_TIME; END;

技术图片

输出的格式为上图;

 

oracle计算两个时间的差值(XX天XX时XX分XX秒)

标签:run   creat   src   star   png   http   oracl   pre   oracle   

人气教程排行