更简单的解决方案:SELECT numtodsinterval(date1-date2,'day') time_difference from dates;对于时间戳:SELECT (extract(DAY FROM time2-time1)*24*60*60)+ (extract(HOUR FROM time2-time1)*60*60)+(extract(MINUTE FROM time2-time1)*60)+extract(SECOND FROM time2-time1)into diff FROM dual;RETURN diff;分享编辑