I am facing a issue in project I am working on, I can not give you actual code but I have created a executable sample code as below
Here temp and
There is another way in which this might be accomplished, namely by using LIKE:
SELECT ti.*
FROM temp t, temp_id ti
WHERE ',' || REPLACE(t.ids, ' ') || ',' LIKE '%,' || TO_CHAR(ti.data_id) || ',%'
(I used REPLACE() above to get rid of the extraneous whitespace in the ID list - makes things a bit simpler.) Alternately, one could use REGEXP_LIKE():
SELECT ti.*
FROM temp t, temp_id ti
WHERE REGEXP_LIKE(REPLACE(t.ids, ' '), '(^|,)' || TO_CHAR(ti.data_id) || '(,|$)')
[The caret (^) and dollar-sign ($) characters are to match the start and end, respectively, of the string -- so the ID can either match something at the start of the string (ending with a comma or the end of the string) or something starting with a comma (again, ending with a comma or the end of the string).]