INSTR2 scalar function

The INSTR2 function returns the starting position, in 16-bit UTF-16 string units (CODEUNITS16), of a string within another string.

Read syntax diagramSkip visual syntax diagramINSTR2(source-string, search-string ,start,instance )

The schema is SYSIBM.

source-string
An expression that specifies the string in which the search is to take place.
search-string
An expression that specifies the string that is the object of the search.
start
An expression that specifies the position within source-string at which the search for a match is to start.
instance
An expression that specifies which instance of search-string to search for within source-string.

The INSTR2 scalar function invoked with character or graphic strings as the first two arguments is equivalent to invoking the LOCATE_IN_STRING function with CODEUNITS16 specified. The INSTR2 scalar function invoked with binary strings as the first two arguments is equivalent to invoking the LOCATE_IN_STRING function without a string units argument.