把一个数字字符串的每一位用逗号隔开,但若是0,只要逗号例如:340902
輸出:3,4,,9,,2

解决方案 »

  1.   

    http://space.itpub.net/20948385/viewspace-665735
    我也在学习中,关注
      

  2.   

    抛砖引玉SQL>  select replace(rtrim(regexp_replace('340902', '(.)', '\1,'), ','), '0')
      2     from dual;
     
    REPLACE(RTRIM(REGEXP_REPLACE('
    ------------------------------
    3,4,,9,,2
     
      

  3.   

    多谢yinan9要若是0,跳过去,正则式该如何修改?例如:340902
    輸出:3,4,9,2我这是:得寸进尺
      

  4.   

    稍作修改即可 select replace(rtrim(regexp_replace('340902', '(.)', '\1,'), ','), '0,')
       from dual;