CREATE
OR
REPLACE
TYPE
TYPE_SPLIT
as
table
of
varchar2
(200);
create or replace function f_split(p_list varchar2,
p_sep varchar2 := ',')
return
TYPE_SPLIT
pipelined
is
l_idx pls_integer;
v_list varchar2(200) := p_list;
begin
loop
l_idx := instr(v_list, p_sep);
if l_idx > 0 then
pipe row(substr(v_list, 1, l_idx - 1));
v_list := substr(v_list, l_idx + length(p_sep));
else
pipe row(v_list);
exit;
end if;
end loop;
return;
end
f_split
;
select
column_value km
from
table
(cpm_f_split(v_kms, ',');