id   value
----------------------
a1    23
a2    56
a3    46
a4    13
a5    98
.      .
.      .
.      .
.      .
.      .转换为 
a1 a2 a3 a4..............
--------------------------
23 56 46 13..............这个查询怎么写,,,只用语句,,,不想用过程什么的!!!

解决方案 »

  1.   


    10g试试下面的方法:
    SELECT replace(WMSYS.WM_CONCAT(id),',',' ') FROM tablea
    union
    SELECT replace(WMSYS.WM_CONCAT(value),',',' ')  FROM tablea;
      

  2.   

    select 
       case id when 'a1' then value end a1,
       case id when 'a2' then value end a2,
       case id when 'a3' then value end a3,
       case id when 'a4' then value end a4,
       case id when 'a5' then value end a5,
       case id when 'a6' then value end a6,
       case id when 'a7' then value end a7
    from 表...
      

  3.   

    那用不定行转列,用动态的SQL!
      

  4.   

    http://cosio.itpub.net/post/10244/467060 
    多行转列肯定要用到过程!
      

  5.   

    select sum(decode(id,'a1',value,0))"a1",
           sum(decode(id,'a2',value,0))"a2",
           .
           .
           .
           .
           
    from table;