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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:50:33+00:00 2026-05-26T22:50:33+00:00

How can write a query for Oracle database such that I can find a

  • 0

How can write a query for Oracle database such that I can find a comma delimited list of values from a column that contains comma delimited list of values. The :parameter passed to sql statement is also a comma delimited values that user selected.

For e.g
We have a column in tables that contains

1 | ‘A’,’B’,’C’

2 | ‘C’,’A’

3 | ‘A’,’B’

on the web application interface we have multi select box that shows
A
B
C
and allows user to to select one or more items.

I want rows 1 and 2 to show up if they select A and B, If they select A only the all three should show up b/c all rows 1 to 3 have ‘A’ value in it.

  • 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-26T22:50:34+00:00Added an answer on May 26, 2026 at 10:50 pm

    This example will hopefully help and it matches the values irrespective of which order they appear in the string in the DB record.

    Create example table:

    CREATE TABLE t
    (val VARCHAR2(100));
    

    Insert records:

    INSERT INTO t VALUES
    ('1|''A'',''B'',''C''');
    
    INSERT INTO t VALUES
    ('2|''C'',''A''');
    
    INSERT INTO t VALUES
    ('3|''A'',''B''');
    

    Check values:

    SELECT * FROM t;
    
    1|'A','B','C'
    2|'C','A'    
    3|'A','B'
    

    Check solution for ‘A’:

    SELECT val
      FROM t
     WHERE REGEXP_LIKE(val, '(A)');
    
    1|'A','B','C'   
    2|'C','A'      
    3|'A','B'
    

    Check solution for A and B

    SELECT val
      FROM t
     WHERE REGEXP_LIKE(val, '(A|B).*(A|B)');
    
    1|'A','B','C'
    3|'A','B'
    

    If you want to make sure the 1| part of the result isn’t matched by anything then you could query using:

    SELECT val
      FROM t
     WHERE REGEXP_LIKE(val, '(.\|.*)(A)');
    

    and

    SELECT val
      FROM t
     WHERE REGEXP_LIKE(val, '(.\|.*)(A|B).*(A|B)');
    

    Hope this helps…

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

Sidebar

Related Questions

How can I write a LINQ query that returns an hierachical anonymous type from
In SQL one can write a query that searches for a name of a
I'm using Oracle 10g. Question: How can I write query to return just ID
How I can write the query SELECT * FROM doc_docs dd JOIN doc_access da
how can I write a query to get total users, %female, %male from a
i'm trying to write an Oracle query that sorts the results in the same
I have a database table that contains collection data for product collected from a
How can I write a query to transform a list of numbers into 2
How can I write a query similar to this one in LINQ to SQL
how can i write the query, to update the table videos , and set

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.