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 8667787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:03:33+00:00 2026-06-12T18:03:33+00:00

I am having trouble getting a block of pl/sql code to work. In the

  • 0

I am having trouble getting a block of pl/sql code to work. In the top of my procedure I get some data from my oracle apex application on what checkboxes are checked. Because the report that contains the checkboxes is generated dynamically I have to loop through the

APEX_APPLICATION.G_F01 

list and generate a comma separated string which looks like this

v_list VARCHAR2(255) := (1,3,5,9,10);

I want to then query on that list later and place the v_list on an IN clause like so

SELECT * FROM users 
WHERE user_id IN (v_list);

This of course throws an error. My question is what can I convert the v_list to in order to be able to insert it into a IN clause in a query within a pl/sql procedure?

  • 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-06-12T18:03:35+00:00Added an answer on June 12, 2026 at 6:03 pm

    If users is small and user_id doesn’t contain commas, you could use:

    SELECT * FROM users WHERE ',' || v_list || ',' LIKE '%,'||user_id||',%'
    

    This query is not optimal though because it can’t use indexes on user_id.

    I advise you to use a pipelined function that returns a table of NUMBER that you can query directly. For example:

    CREATE TYPE tab_number IS TABLE OF NUMBER;
    /
    CREATE OR REPLACE FUNCTION string_to_table_num(p VARCHAR2)
       RETURN tab_number
       PIPELINED IS
    BEGIN
       FOR cc IN (SELECT rtrim(regexp_substr(str, '[^,]*,', 1, level), ',') res
                    FROM (SELECT p || ',' str FROM dual)
                  CONNECT BY level <= length(str) 
                                      - length(replace(str, ',', ''))) LOOP
          PIPE ROW(cc.res);
       END LOOP;
    END;
    /
    

    You would then be able to build queries such as:

    SELECT * 
      FROM users 
     WHERE user_id IN (SELECT *
                         FROM TABLE(string_to_table_num('1,2,3,4,5'));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote some AES encryption code in C# and I am having trouble getting
im having trouble getting a string (containing a URL) from one activity to another.
I'm having trouble getting the CanExecute method of my command to work property. I've
I'm currently having trouble getting example code for using tweepy to access Twitter's Streaming
I am having trouble getting my application to work correctly. I am trying to
I'm having trouble getting my CSS to work :( HTML <form action=/api/submit/ method=post> <textarea
I'm having a tad bit of trouble getting the jQuery Form Plugin to work
I've been having trouble with this parallel matrix multiplication code, I keep getting an
Hey I'm having trouble getting my code to compare the integers of a given
I'm having some trouble getting my page laid out the way I want. I

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.