你可以写个函数sumstr(v_str),不过这很难了

解决方案 »

  1.   

    1、没有这样的聚集函数2、这样有意义吗?
       如果原表中行数不固定,则无法实现。
       如果行数固定,实在没有任何意义:select max(decode(id,1,value)) col1 ,
           max(decode(id,2,value)) col2 ,
           max(decode(id,3,value)) col3 
      from table1 group by id;行转化为列的典型例子:
    表一:科目表
    代码   名称
    -----------
    1      语文
    2      数学
    3      外语表二:成绩单
    学号  科目   成绩
    ------------------
    1     1      90
    1     2      95
    1     3      95
    2     1      92
    2     2      92
    2     3      97
    3     1      95
    3     2      90
    3     3      91转化:
    select 学号,
           sum(decode(科目,1,成绩) 语文,
           sum(decode(科目,2,成绩) 数学,
           sum(decode(科目,3,成绩) 外语,
      from 成绩单
     group by 学号;
      

  2.   

    select aa.col||','||bb.col||','||cc.col from (select col form table where id=1) aa,(select col from table where id=2) bb,(select col from table where id=3) cc这样方法好笨,多列联合就复杂, 还是用过程实现吧.