当前位置: 代码迷 >> SQL >> 用pl/sql瓜分字符串
  详细解决方案

用pl/sql瓜分字符串

热度:85   发布时间:2016-05-05 13:30:15.0
用pl/sql分割字符串

http://www.blogjava.net/ilovebabyfat/archive/2011/06/29/353358.html

http://space.itpub.net/441887/viewspace-666310

?

?

http://xiaobo.iteye.com/blog/310628

?

oracle分隔后入数组中:

create or replace procedure test is        str varchar2(100);         startposition number(10);         len number(10);         output varchar2(100);   type sql_array is table of task_schedule_query.sqlstr%type index by binary_integer;  sqlarray sql_array;  lpindex number(10);begin       sqlarray(1):='';  sqlarray(2):='';  sqlarray(3):='';  sqlarray(4):='';    str:='hello,nick,xingxing';      startposition:=1;      lpindex := 1;     loop                       select instr(str,',',startposition ) into len from dual;                       dbms_output.put_line(startposition);                       dbms_output.put_line(len);                                       if len!=0 then                           select substr(str,startposition,len-startposition) into sqlarray(lpindex) from dual;                      else                             select substr(str,startposition) into sqlarray(lpindex) from dual;                             dbms_output.put_line(sqlarray(lpindex));                             exit;                         end if;                                          dbms_output.put_line(sqlarray(lpindex));                         startposition:=len+1;                          dbms_output.put_line('-------------------------------------');             lpindex:=lpindex+1;        		end loop;     end; 

?

  相关解决方案