0

I have already viewed similar questions but didn't find the answer I am looking for. My table looks like this.

ID  Name  Group
1   R1    A,B
2   R2    C,D,E
3   R3    A
4   R4    B,E

What I am looking for is able to use the 'Group' field in an IN clause where the IN clause will be a prompt. Example: Group in ('A','B','C')

I am not a pl/sql expert so would truly appreciate the help!

Note: Changing the table structure is not an option. Previous solutions does not take into consideration passing multiple values which are in the format 'A','B','C' instead of 'A,B,C'

Cindy
  • 133
  • 1
  • 5
  • 13
  • 1
    You can't use the Group "field" in an IN condition, because the IN condition requires a comma-separated list of individual strings (in your example). The table stores a single string - the fact that it contains commas within the string doesn't make it something else (namely, a list of many strings, separated by comma). So, you must either split those strings before using in an IN condition, or you must use a different condition instead of IN. (For example you could use LIKE.) Then: Why is changing the table structure not an option? That should be the first thing to consider. –  Nov 17 '17 at 16:09
  • Both methods (splitting the string and using a LIKE condition instead of IN) have been shown in many other questions on this site, did you do a search before posting the question? –  Nov 17 '17 at 16:10
  • change the structure. it is an option. – Randy Nov 17 '17 at 16:14
  • I have already looked through other solutions including the In_List function by ask tom but not getting the results. These tables are populated by our application and the structure cannot be changed. I can use a split function but the values in the Group column is not fixed so not sure how to proceed. – Cindy Nov 17 '17 at 16:17
  • This post has several solutions for this issue. Of course I'm partial to my own....https://stackoverflow.com/questions/45183349/search-comma-separated-value-in-oracle-12/45246919#45246919 – Gary_W Nov 17 '17 at 16:34

0 Answers0