create or replace function F_GetSplit
(
/*****************************************************************
功能说明:分割函数,可等同于java中的split
参数说明:
输入参数
sStr in varchar2, 要处理的字符串
sDelimiter in varchar2 分割标准
****************************************************************/
sStr in varchar2,
sDelimiter in varchar2
)
return ty_str_split
is
j int :=0;
i int :=1;
len int :=0;
len1 int :=0;
str varchar2 (4000);
sStrSplit ty_str_split := ty_str_split ();
begin
len := length(sStr);
len1 := length(sDelimiter);
while (j < len)
loop
j := instr(sStr, sDelimiter, i);
if (j = 0) then
j := len;
str := substr(sStr, i);
sStrSplit.extend;
sStrSplit (sStrSplit.count) := str;
if (i >= len) then
exit;
end if;
else
str := substr (sStr, i, j - i);
i := j + len1;
sStrSplit.extend;
sStrSplit (sStrSplit.count) := str;
end if;
end loop;
return sStrSplit;
end F_GetSplit;