- ⌂ Text
- Functions
FIND_IN_SET()
Returns a value in the range of 1 to N
if the string str
is in the string list strlist
consisting of N
substrings. A string list is a string composed of substrings separated by comma (,
) characters. Returns 0
if str
is not in strlist
or if strlist
is the empty string. Returns NULL
if either argument is NULL
.
This function does not work properly if the first argument contains a comma (
,
) character.Prototype
integer FIND_IN_SET(string $str, string $strlist)
Parameters
- str - The string to search for in strlist.
- strlist - A comma-separated list of strings to match against.
Return
Return the index position of the first argument within the second argument. Returns 0
if str
is not in strlist
or if strlist
is the empty string. Returns NULL
if either argument is NULL
.
Example
SELECT FIND_IN_SET(OID,'123,234,345') AS Index FROM User