http://community.csdn.net/Expert/topic/5111/5111737.xml?temp=.1163141

解决方案 »

  1.   

    create or replace procedure substring_array(str in varchar2) as
    type array_str is table of varchar2(100)
         index by binary_integer;
    myarray array_str;
    v_str varchar2(4000) default str;
    begin
      for i in 0 .. length(str)-length(replace(str,',',''))+1 loop      if instr(v_str,',') = 0 then 
              myarray(i+1) := v_str ;
          else 
              myarray(i+1) := substr(v_str,0,instr(v_str,',')-1);       
          end if;
          v_str := substr(v_str,instr(v_str,',')+1);
      end loop;
      
      for i in 0 ..length(str)-length(replace(str,',','')) loop
          dbms_output.put_line(myarray(i+1));
      end loop ;
    end substring_array;