Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1104405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:28:46+00:00 2026-05-17T01:28:46+00:00

How do I convert a comma separated string to a array? I have the

  • 0

How do I convert a comma separated string to a array?

I have the input ‘1,2,3' , and I need to convert it into an array.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:28:47+00:00Added an answer on May 17, 2026 at 1:28 am

    Oracle provides the builtin function DBMS_UTILITY.COMMA_TO_TABLE.

    Unfortunately, this one doesn’t work with numbers:

    SQL> declare
      2    l_input varchar2(4000) := '1,2,3';
      3    l_count binary_integer;
      4    l_array dbms_utility.lname_array;
      5  begin
      6    dbms_utility.comma_to_table
      7    ( list   => l_input
      8    , tablen => l_count
      9    , tab    => l_array
     10    );
     11    dbms_output.put_line(l_count);
     12    for i in 1 .. l_count
     13    loop
     14      dbms_output.put_line
     15      ( 'Element ' || to_char(i) ||
     16        ' of array contains: ' ||
     17        l_array(i)
     18      );
     19    end loop;
     20  end;
     21  /
    declare
    *
    ERROR at line 1:
    ORA-00931: missing identifier
    ORA-06512: at "SYS.DBMS_UTILITY", line 132
    ORA-06512: at "SYS.DBMS_UTILITY", line 164
    ORA-06512: at "SYS.DBMS_UTILITY", line 218
    ORA-06512: at line 6
    

    But with a little trick to prefix the elements with an ‘x’, it works:

    SQL> declare
      2    l_input varchar2(4000) := '1,2,3';
      3    l_count binary_integer;
      4    l_array dbms_utility.lname_array;
      5  begin
      6    dbms_utility.comma_to_table
      7    ( list   => regexp_replace(l_input,'(^|,)','\1x')
      8    , tablen => l_count
      9    , tab    => l_array
     10    );
     11    dbms_output.put_line(l_count);
     12    for i in 1 .. l_count
     13    loop
     14      dbms_output.put_line
     15      ( 'Element ' || to_char(i) ||
     16        ' of array contains: ' ||
     17        substr(l_array(i),2)
     18      );
     19    end loop;
     20  end;
     21  /
    3
    Element 1 of array contains: 1
    Element 2 of array contains: 2
    Element 3 of array contains: 3
    
    PL/SQL procedure successfully completed.
    

    Regards,
    Rob.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a comma-separated string that I want to convert into an array, so
I am trying to convert a comma separated string into an array using the
Is there any way to convert a comma separated string into an array in
I have a string with comma separated values: var x = '1,2,10,11,12'; I need
i have an array and i want to convert this array in comma seprated
I need a way to convert a number into formatted way by inserting comma
How do I easily convert a string containing two floats separated by a comma
i have an array and i want to convert this array in comma seprated
I am using the following to convert comma separated string to list. string productId
Is there a way to convert a list of values into a comma-delimited string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.