在oracle中表格name          telephone
王三/赵四/刘五 123/456/789我想分割成
王三 123
赵四 456
刘五 789在pl/sql中如何写谢谢大家

解决方案 »

  1.   

    如果 格式是固定的  你用substr( string, start_position, [ length ] )  就可以了
      

  2.   

    在PL/SQL中可以先使用该语句将Name或Phone字段中的数据拆分,然后使用光标读了每一个结果。
    再插入到其它表中。
      

  3.   

    tb表里只有一条数据……
    name telephone
    王三/赵四/刘五 123/456/789
    select regexp_substr(name,'[^/]+',1,rownum) name,
    regexp_substr(telephone,'[^/]+',1,rownum) telephone
    from tb connect by rownum<=length(regexp_replace(name||'/','[^/]+'))
    多条的话 
    with tb2 as(select replace(wm_concat(name),',','/') ,
    replace(wm_concat(telephone),',','/') 
    from tb)再将上面sql中的tb 换成tb2
    数据量不大的话上述的情况可以解决
    不过wm_concat()函数连接字符有上限