日期:2014-05-17 浏览次数:20904 次
SELECT id, level,val FROM tab CONNECT BY LEVEL<=3 1 1 AA 1 2 AA 1 3 AA 2 3 BB 2 2 BB 1 3 AA 2 3 BB 2 1 BB 1 2 AA 1 3 AA 2 3 BB 2 2 BB 1 3 AA 2 3 BB 的出十四条记录
with x as (select 'aa' chr from dual union all select 'bb' chr from dual) select level,chr,lpad(' ',(level-1)*5,'-')||chr other from x connect by level<=3; LEVEL CHR OTHER ----- ------ ---------------------- 1 aa aa 2 aa ---- aa 3 aa --------- aa 3 bb --------- bb 2 bb ---- bb 3 aa --------- aa 3 bb --------- bb 1 bb bb 2 aa ---- aa 3 aa --------- aa 3 bb --------- bb 2 bb ---- bb 3 aa --------- aa 3 bb --------- bb