I use java.util.StringTokenizer for simple parsing of delimited strings in java. I have a need for the same type of mechanism in pl/sql. I could write it, but if it already exists, I would prefer to use that. Anyone know of a pl/sql implementation? Some useful alternative?
PL/SQL does include a basic one for comma separated lists (DBMS_UTILITY.COMMA_TO_TABLE
).
Example:
DECLARE
lv_tab_length BINARY_INTEGER;
lt_array DBMS_UTILITY.lname_array;
BEGIN
DBMS_UTILITY.COMMA_TO_TABLE( list => 'one,two,three,four'
, tablen => lv_tab_length
, tab => lt_array
);
DBMS_OUTPUT.PUT_LINE( 'lv_tab_length = ['||lv_tab_length||']' );
FOR i IN 1..lv_tab_length
LOOP
DBMS_OUTPUT.PUT_LINE( '['||lt_array( i )||']' );
END LOOP;
END;
/
Or see this Ask Tom link for other ideas...