开发者

create multiple default value rows in oracle 11g

开发者 https://www.devze.com 2023-03-24 07:49 出处:网络
select \'a\' as st,\'x\' as ed from dual union all select \'b\' as st,\'y\' as ed from dual union all select \'c\' as st,\'z开发者_C百科\' as ed from dual
select 'a' as st,'x' as ed from dual
union all
select 'b' as st,'y' as ed from dual
union all
select 'c' as st,'z开发者_C百科' as ed from dual

Instead can we write some thing like using directly with pivot/unpivot and connect by cclause in one slect statement


You could do something like this assuming you just want consecutive characters in consecutive rows

SQL> ed
Wrote file afiedt.buf

  1  select chr( ascii('a') + level - 1) st,
  2         chr( ascii('x') + level - 1) ed
  3    from dual
  4* connect by level <= 3
SQL> /

ST   ED
---- ----
a    x
b    y
c    z
0

精彩评论

暂无评论...
验证码 换一张
取 消