日期:2014-05-17 浏览次数:20816 次
select extract(HOUR FROM TIMESTAMP '2010-10-10 9:10:10') as 小时, extract(MINUTE FROM TIMESTAMP '2010-10-10 9:10:10') as 分钟 , ceil((extract(HOUR FROM TIMESTAMP '2010-10-10 9:10:10')*60+extract(MINUTE FROM TIMESTAMP '2010-10-10 9:10:10'))/15) as 节点 from dual;
------解决方案--------------------
select to_char(sysdate, 'yyyymmdd hh24:mi:ss') dt,BASE_TAB.node from ( select to_char(trunc(sysdate) + interval '15' minute * (level - 1),'hh24mi') bt, to_char(trunc(sysdate) + interval '15' minute * (level) - interval '1' minute,'hh24mi') et, level node from dual connect by level <= 96 ) base_tab, dual where to_char(sysdate, 'hh24mi') between base_tab.bt and base_tab.et DT NODE ------------------------- ---------- 20100603 15:12:39 61
------解决方案--------------------
select sysdate,trunc(sysdate,'hh')+floor(to_char(sysdate,'mi')/15)*15/60/24 from dual;
-------------
2010-6-3 19:54:34 2010-6-3 19:45:00