一、生成1至10記錄sql
select rownum from dual connect by rownum <= 10
結果:spa
1
2
3
4
5
6
7
8
9
10code
二、生成最近12個月記錄blog
select to_char(add_months(sysdate, rownum - 12), 'yyyyMM') time from dual connect by rownum <= 12
結果:class
201805
201806
201807
201808
201809
201810
201811
201812
201901
201902
201903
201904date
一個用途:查詢最近12個月數據,若是沒有數據,也要返回記錄,能夠用上面sql語句做爲主表左關聯業務表。select