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 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

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I want to count how many characters a certain string has in PHP, but
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into

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.