Parse a string [message #2664] |
Mon, 05 August 2002 10:10 |
JOHN
Messages: 182 Registered: April 1998
|
Senior Member |
|
|
Hey guys,
I am passing a string in to the store procedure. The string is comma delimited. I want to parse throught the string and save each entry as a new row in the database. I want to create an array so I can loop through the list. Please advise.
Thanks
|
|
|
Re: Parse a string [message #2666 is a reply to message #2664] |
Mon, 05 August 2002 12:22 |
Todd Barry
Messages: 4819 Registered: August 2001
|
Senior Member |
|
|
There is a built-in routine in dbms_utility.comma_to_table that will convert a comma-delimited list into a PL/SQL table (array).
sql>declare
2 a dbms_utility.uncl_array;
3 len pls_integer;
4 begin
5 dbms_utility.comma_to_table('One,Two,Three,Four', len, a);
6 for i in 1..a.count loop
7 dbms_output.put_line( a(i) );
8 end loop;
9 end;
10 /
One
Two
Three
Four
PL/SQL procedure successfully completed.
|
|
|
Re: Parse a string [message #4418 is a reply to message #2666] |
Fri, 06 December 2002 06:59 |
Ivan Scattergood
Messages: 1 Registered: December 2002
|
Junior Member |
|
|
I can 't get this to work for a comma seperated list of numbers. If i change the call to:
dbms_utility.comma_to_table('1,2,3,4', len, a);
I get:
ERROR at line 1:
ORA-00931: missing identifier
ORA-06512: at "SYS.DBMS_UTILITY", line 105
ORA-06512: at "SYS.DBMS_UTILITY", line 140
ORA-06512: at "SYS.DBMS_UTILITY", line 182
ORA-06512: at line 5
Is there anything I can do ?
|
|
|