举例:
0101
1010这是2行内容。
现在想合并成   1111
如何实现?同理     1000     合并   1000  结果 1000就是    一共4个字符,如果个位有一个为1   得到新数的个位就为1   同理到   百位  ,千位,万位。

解决方案 »

  1.   

    http://space.itpub.net/498744/viewspace-281099
      

  2.   

    有个笨点的办法可参考:
    with a as(
    select '0101' z from dual
    union all
    select '1010' z from dual
    union all
    select '1010' z from dual
    union all
    select '1111' z from dual
    union all
    select '0000' z from dual
    )select replace(replace(replace(replace(replace(replace(replace(replace(to_char(sum(to_number(z))),'2','1'),'3','1'),'4','1'),'5','1')
    ,'6','1'),'7','1'),'8','1'),'9','1') from a;
      

  3.   

    with a as
    ( select '0001' A from dual
      union all 
     select '1100' from dual
    )
    select replace(max(substr(sys_connect_by_path(rm,','),2)),',','')
    from
    (
      select ( case when substr(a,level,1)=0 then 0 else 1 end) rm,rownum rn
      from
             (select sum(a) a from a)
      connect by level<=length(a)
    )
    start with rn=1 connect by rn=rownum ;   --result:1 1101