Skip to Main Content
  • Questions
  • COMMA_TO_TABLE not found/ Invalid identifiers

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question.

Asked: August 12, 2022 - 1:49 pm UTC

Last updated: August 16, 2022 - 2:35 am UTC

Version: apex on cloud

Viewed 1000+ times

You Asked


declare
  
 v_list varchar2(4000);
begin
   begin
      v_list := :P4_STATES;
      exception when no_data_found then v_list :='0';
   end;
   for y in (select * from(table(DBMS_UTILITY.comma_to_table(:P4_STATES))))
   loop
   INSERT INTO COVIDAPI(STATES_NO) values(y.COLUMN_VALUE);
   end loop;


   for y in (select * from(table(comma_to_table(:P4_POSITIVE))))
   loop
   insert into COVIDAPI(POSITIVE)
   values(y.column_value);
   end loop;
   for y in (select * from(table(comma_to_table(:P4_NEGATIVE))))
   loop
   insert into COVIDAPI(NEGATIVE)
   values(y.column_value);
   end loop;
end;


error:ORA-06550: line 9, column 47: PL/SQL: ORA-00904: : invalid identifier



select * from all_objects where object_name ='COMMA_TO_TABLE'

result: no data found

question: how to install or create the COMMA_TO_TABLE package?
I use apex on cloud, it's not installed in my laptop!

and Connor said...

Firstly, be aware that DBMS_UTILITY.COMMA_TO_TABLE is not exactly what it seems. It's designed for particular purpose, not generic parsing

See https://asktom.oracle.com/pls/apex/asktom.search?tag=dbms-utilitycomma-to-table-limitations for details.

Here's a video which talks about using SQL to parse commas into rows



with associated scripts

https://livesql.oracle.com/apex/livesql/file/content_C40G9LF09VJ8W43VGG7ZXDAMO.html

which will let you achieve what you want.

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library