Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: How to extract indiviual substring
You can have a look at dbms_utility.comma_to_table function or at the following function from Thomas Kyte:
ops$tkyte_at_8i> create or replace type myTableType as table of number; 2 /
Type created.
ops$tkyte_at_8i> create or replace function in_list( p_string in varchar2 ) return myTableType 2 as
3 l_data myTableType := myTableType(); 4 l_string long default p_string || ','; 5 l_n number;
8 loop 9 exit when l_string is null; 10 l_data.extend; 11 l_n := instr( l_string, ',' ); 12 l_data( l_data.count ) := substr( l_string, 1, l_n- 1 ); 13 l_string := substr( l_string, l_n+1 ); 14 end loop; 15 return l_data;
Function created.
These two functions convert a comma separated list to a table.
-- Hope this helps Michel "C Chang" <cschang_at_maxinter.net> a écrit dans le message news: 3B5F856F.7CDE_at_maxinter.net...Received on Thu Jul 26 2001 - 03:09:26 CDT
> As a newbie, I like to learn how to extract substring from a long string
> wiht some kind of sommon separator, ex "," or ";". for example I have a
> long string like - Name;123456;45.67 as an input variable, How do I
> extract the substring into an array as { Name, 1233456, 45.67} ? I have
> tried combine substr and lenght functions but no success. Can Any guru
> help me? Thanks.
>
> C Chang
![]() |
![]() |