SQL to Compare one string among multiple values in another string .
Example : I have 2 string as following. In first_string="B"
and in second_string="A,B,C,D,E".
How do i compare first_string against individual value of second_string?
IF the value of the First String is among the values of Second string then i need to proceed with the further actions.
If you need to do this using strings, you can use like
:
where ',' || second_string || ',' like '%,' || first_string || ',%'
However, I would suggest that you investigate alternatives to storing such values in strings. Tables (including nested tables) are a better choice. You can also use JSON and similar formats.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.