表中有一个字段col,它的类型是varchar2的,它存储的格式为“123.45@@111@@...”,现在的问题是能不能在存储过程中用PL/SQL实现如下功能:
取出col的值后以“@@”为分割符分割出123.45和111等,即实现java语言中String的split方法

解决方案 »

  1.   

    http://builder.com.com/5100-6388_14-5259821.html
    Oracle Tip: Create functions to join and split strings in SQL
      

  2.   

    http://community.csdn.net/Expert/topic/3834/3834618.xml?temp=.5723078
      

  3.   

    for example:SQL> declare
      2  v_str varchar2(50);
      3  begin
      4  v_str:='123@@12.45@@248';
      5  while instr(v_str,'@@')>0 loop
      6  dbms_output.put_line(substr(v_str,1,instr(v_str,'@@')-1));
      7  v_str:=substr(v_str,instr(v_str,'@@')+2);
      8  end loop;
      9  dbms_output.put_line(v_str);
     10  end;
     11  /
    123
    12.45
    248PL/SQL 过程已成功完成。SQL>