create or replace type ARRYTYPE1 is VARRAY(10) OF VARCHAR(100);
CREATE OR REPLACE FUNCTION FUNC_GETSPLITSTR(in_str IN VARCHAR2, --需分割的字符串
) RETURN arrytype1 AS
v_up int;
v_count int;
v_strlist arrytype1;
v_curnode VARCHAR2(10);
v_node VARCHAR2(2000);
BEGIN
v_up := 0;
v_count := 0;
v_strlist := arrytype1();
IF (in_str IS NULL) OR (LENGTH(in_str) <= 0) THEN
RETURN NULL;
END IF;
FOR v_i IN 1 .. LENGTH(in_str) LOOP
v_curnode := SUBSTRB(in_str, v_i, 1);
if v_curnode = in_split then
v_node := SUBSTRB(in_str, v_up + 1, v_i - v_up - 1);
v_up := v_i;
else
if v_i = LENGTH(in_str) then
v_node := SUBSTRB(in_str, v_up + 1, v_i - v_up);
end if;
end if;
IF v_node IS NULL THEN
v_node := '';
else
v_strlist.EXTEND();
v_count := v_count + 1;
v_strlist(v_count) := v_node;
v_node := '';
END IF;
END LOOP;
RETURN v_strlist;
END FUNC_GETSPLITSTR;