1
create or replace type my_obj_table as object
(
id number(10),
name varchar2(50)
);
2
create or replace type my_table is table of my_obj_table;
3
create or replace function f_splitSTR
(
s varchar,
split varchar
)
return my_table
as
rs my_table:=my_table();
-- mot my_object_table:=my_object_table();
tmpStr varchar2(50):='';
tmps varchar(500):='';
begin
tmps:=s||split;
WHILE INSTR(tmps,split) >0
LOOP
rs.extend;
tmpStr := SUBSTR(tmps,1,INSTR(tmps,split));
rs(rs.count):=my_obj_table(rs.count,TRIM(TRAILING split FROM tmpStr ));
--DBMS_OUTPUT.PUT_LINE(tmpStr);
tmps:=REPLACE(tmps,tmpStr,'');
END LOOP;
return rs;
end f_splitSTR;