DB2 Version 10.1 for Linux, UNIX, and Windows

INSTRB scalar function

The INSTRB function returns the starting position, in bytes, of a string within another string.

Read syntax diagramSkip visual syntax diagram
>>-INSTRB--(--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 INSTRB scalar function invoked with character or graphic strings as the first two arguments is equivalent to invoking the LOCATE_IN_STRING function with OCTETS specified. The INSTRB 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.