Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Find comma separated list of values in a database field

khennAug 6 2015 — edited Aug 7 2015

This is kind of hard to describe, but I have a database table with field A that may contain a string, say "AB12345".  I have another database table with field B that contains a string "12345,6789034,54637".

I need to figure out how to write a where clause such that the row of data with the value of "AB12345" in column A is returned when any of the 3 comma separated values stored field B match.

So, basiclly

WHERE A LIKE '%12345%'

OR A LIKE '%6789034%'

OR A LIKE '%54637%'

but I can't write it like above because the value of B is dynamic.  The value of B could be "1234524" or "34567,239824" or "12340,512346,623462112" or an combination list of possible numbers.

Anyone have any ideas? I think this is going to require regular expressions, but I'm not sure it's doable.

Thanks,

Kris

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 4 2015
Added on Aug 6 2015
6 comments
3,265 views