Oracle ->> Oracle下生成序列的方法

用hierachical query,即connect by配合dual表生成序列,mod这个是取余函数,生成group factor。最后面的connect by rownum <= 100可以替换为connect by level <= 100

select case when mod(rownum,200000) = 0 then 5
else mod(rownum,4)
end X,
LEVEL Lvl,
rpad( 'x', 100, 'x' ) data
from dual
connect by rownum <= 100

 

posted @ 2015-07-05 16:49  Jerry_Chen  阅读(753)  评论(0编辑  收藏  举报