oracle 分割字符串方法以及关联数组与bulk into的使用
create or replace
PROCEDURE PRO_TEST AS
//声明一个关联数组类型
TYPE myarryId is TABLE OF varchar2(20) index by PLS_INTEGER;
//定义关联数组变量
myarr myarryId;
//定义数组的下标变量
myIndex PLS_INTEGER;
BEGIN
select regexp_substr('abc,def,ggg,1,2,3,4,5', '[^,]+', 1,x.n) bulk collect into myarr from dual a, (select rownum n from dual connect by rownum < 10) x;
myIndex:=myarr.FIRST;
while(myIndex is NOT NULL)
loop
dbms_output.put_line(myarr(myIndex));
myIndex:=myarr.NEXT(myIndex);
end loop;
END PRO_TEST;