create or replace function utl_split(str_in in varchar2, delim_in in varchar2 default '.')
return SplitType as
/* !!!!!!!!!!!!!!!!! Warnning Please Read it before Use or Compile !!!!!!!!!!!!!!!!!!!!!!
Author by Pompa if first compile you must be create object type as below script
before compilie this function
==scrip==============================
create or replace type SplitType as table of varchar2(500); / ==scrip==============================
How to use You can use by 2 method
1. SELECT * FROM TABLE (CAST (utl_split ('10.01.03.04.234') AS SplitType))
2. declare catch_tmp SplitType;
begin
catch_tmp := utl_split('12345678910','') ;
for i in 1 .. catch_tmp.count loop
dbms_output.put_line(catch_tmp(i));
end loop;
end; */
str_tmp long default str_in delim_in;
indx_tmp number;
return_tmp SplitType := SplitType();
begin
loop indx_tmp := instr( str_tmp, delim_in );
exit when (nvl(indx_tmp,0) = 0);
return_tmp.extend;
return_tmp( return_tmp.count ) := ltrim(rtrim(substr(str_tmp,1,indx_tmp-1)));
str_tmp := substr( str_tmp, indx_tmp+length(delim_in) );
end loop;
return return_tmp;
end utl_split;
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment