求分钟:
SELECT CEIL((TO_DATE('2016-07-19 10:10:10' , 'YYYY-MM-DD HH24-MI-SS') - TO_DATE('2016-07-19 10:07:50' , 'YYYY-MM-DD HH24-MI-SS'))* 24*60 ) as HOURS FROM DUAL;
执行结果如下
HOURS
3
求小时:
SELECT CEIL((TO_DATE('2016-07-19 15:10:10' , 'YYYY-MM-DD HH24-MI-SS') - TO_DATE('2016-07-19 10:07:50' , 'YYYY-MM-DD HH24-MI-SS'))* 24 ) AS minutesFROM DUAL;
执行结果如下
minutes
6
求秒:
SELECT CEIL((TO_DATE('2016-07-19 10:10:10' , 'YYYY-MM-DD HH24-MI-SS') - TO_DATE('2016-07-19 10:07:50' , 'YYYY-MM-DD HH24-MI-SS'))* 24*60*60 ) as SECOND FROM DUAL;
执行结果如下:
SECOND
140
20160719@CHUNGKING YUBEI