日期:2014-05-17 浏览次数:20828 次
有两个日期数据START_DATE,END_DATE,欲得到这两个日期的时间差(以天,小时,分钟,秒,毫秒): 天: ROUND(TO_NUMBER(END_DATE - START_DATE)) 小时: ROUND(TO_NUMBER(END_DATE - START_DATE) * 24) 分钟: ROUND(TO_NUMBER(END_DATE - START_DATE) * 24 * 60) 秒: ROUND(TO_NUMBER(END_DATE - START_DATE) * 24 * 60 * 60) 毫秒: ROUND(TO_NUMBER(END_DATE - START_DATE) * 24 * 60 * 60 * 60)
------解决方案--------------------
declare vTime number; vTime2 number; begin vTime := dbms_utility.get_time; for i in 1..1000000 loop null; end loop; vTime2 := dbms_utility.get_time; dbms_output.put_line(to_char((vTime2-vTime)/100) || '秒'); end;