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

  • Home
  • SEARCH
  • 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 3345312
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:10:16+00:00 2026-05-18T01:10:16+00:00

I’ve CSV string 100.01,200.02,300.03 which I need to pass to a PL/SQL stored procedure

  • 0

I’ve CSV string 100.01,200.02,300.03 which I need to pass to a PL/SQL stored procedure in Oracle.
Inside the proc,I need to insert these values in a Number column in the table.

For this, I got a working approach from over here:

How to best split csv strings in oracle 9i

[2) Using SQL’s connect by level.].

Now,I’ve another requirement.
I need to pass 2 CSV strings[equal in length] as input to PL/SQL stored proc.And, I need to break this string and insert each value from two CSV strings into two different columns in the table.Could you please let me know how to go about it?

Example of CSV inputs:
mystring varchar2(2000):=’0.75, 0.64, 0.56, 0.45′;

myAmount varchar2(2000):= ‘0.25, 0.5, 0.65, 0.8’;

myString values would go into Column A and myAmount values into Column B in the table.

Could you please let me know how to achieve this?

Thanks.

  • 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-18T01:10:16+00:00Added an answer on May 18, 2026 at 1:10 am

    This should do what you are looking for.. It assumes your list will always be just numbers. If that is not the case, just change the references to DBMS_SQL.NUMBER_TABLE to a table type that works for all of your data:

    CREATE OR REPLACE PROCEDURE insert_from_lists(
        list1_in IN VARCHAR2,
        list2_in IN VARCHAR2,
        delimiter_in IN VARCHAR2 := ','
    )
    IS 
        v_tbl1 DBMS_SQL.NUMBER_TABLE;
        v_tbl2 DBMS_SQL.NUMBER_TABLE;
    
        FUNCTION list_to_tbl
        (
            list_in IN VARCHAR2
        )
        RETURN DBMS_SQL.NUMBER_TABLE
        IS
            v_retval DBMS_SQL.NUMBER_TABLE;
        BEGIN
    
            IF list_in is not null
            THEN
                /*
                || Use lengths loop through the list the correct amount of times,
                || and substr to get only the correct item for that row
                */
                FOR i in 1 .. length(list_in)-length(replace(list_in,delimiter_in,''))+1
                LOOP
                    /*
                    || Set the row = next item in the list
                    */
                    v_retval(i) := 
                            substr (
                                delimiter_in||list_in||delimiter_in,
                                instr(delimiter_in||list_in||delimiter_in, delimiter_in, 1, i  ) + 1,
                                instr (delimiter_in||list_in||delimiter_in, delimiter_in, 1, i+1) - instr (delimiter_in||list_in||delimiter_in, delimiter_in, 1, i) -1
                            );
                END LOOP;
            END IF;
    
            RETURN v_retval;
    
        END list_to_tbl;
    BEGIN 
       -- Put lists into collections
       v_tbl1 := list_to_tbl(list1_in);
       v_tbl2 := list_to_tbl(list2_in);
    
       IF v_tbl1.COUNT <> v_tbl2.COUNT
       THEN
          raise_application_error(num => -20001, msg => 'Length of lists do not match');
       END IF;
    
       -- Bulk insert from collections
       FORALL i IN INDICES OF v_tbl1
          insert into tmp (a, b)
          values (v_tbl1(i), v_tbl2(i));
    
    END insert_from_lists; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace
Specifically, suppose I start with the string string =hello \'i am \' me And
In my XML file chapters tag has more chapter tag.i need to display chapters

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.