1、最近的7天
select Rownum,(trunc(sysdate + Rownum-7,'dd')) past7 from dual connect by rownum <= 7--稍快推荐使用
select Rownum,'dd')) past7 from all_objects where rownum<=7--稍慢
效果如下:
2、最近的24小时
select Rownum,trunc(sysdate,'hh') + rownum / 24 past24 from dual connect by rownum<=24--稍快推荐使用
select Rownum,'hh') + rownum / 24 past24 from all_objects where rownum<=24--稍慢
效果如下: