find_in_set

This function is used to return the position (stating from 1) of str1 in str2 separated by commas (,).

Syntax

find_in_set(string <str1>, string <str2>)

Parameters

Table 1 Parameters

Parameter

Mandatory

Type

Description

str1

Yes

STRING

String to be searched for

str2

Yes

STRING

String separated by a comma (,)

Return Values

The return value is of the BIGINT type.

  • If str1 cannot be matched in str2 or str1 contains commas (,), 0 is returned.
  • If the value of str1 or str2 is NULL, NULL is returned.

Example Code