I have string like this: str:='ac_Abc.88,ac_Abc.99,ac_Abc.77'. I need to get first element after splitting with comma(,). So im using using like this:
str VARCHAR2(500);
dbms_utility.comma_to_table
( list => regexp_replace(str,'(^|,)','\1')
, tablen => l_count
, tab => l_array
);
I'm getting following error:
ORA-20001: comma-separated list invalid near bc.88
ORA-06512: at "SYS.DBMS_UTILITY", line 239
ORA-06512: at "SYS.DBMS_UTILITY", line 272
But if i have string like this, str:='ac_Abc88,ac_Abc99,ac_Abc77', the same method working fine and giving me expected results.
So i guess there is something need to be corrected to consider "." as regular character. Can you please suggest how can i solve this.
See How to split comma delimited string into rows
1. REGEXP_SUBSTR approach
2. XML approach
3. Table function
4. Pipelined Function
It is because (Oracle doc reference)
A "name" referred to here is a valid Oracle (DB object) identifier, for which all naming rules apply.
ac_Abc.88
is not a valid name, because in Oracle you can't have an identifier starting with a digit.To resolve your problem with parsing strings of comma-delimited values, use the below solution of Lalit Kumar's.