IBM Books

SQL Reference

POSSTR

>>-POSSTR--(--source-string--,--search-string--)---------------><
 

The schema is SYSIBM.

The POSSTR function returns the starting position of the first occurrence of one string (called the search-string) within another string (called the source-string). Numbers for the search-string position start at 1 (not 0).

The result of the function is a large integer. If either of the arguments can be null, the result can be null; if either of the arguments is null, the result is the null value.

source-string
An expression that specifies the source string in which the search is to take place.

The expression can be specified by any one of:

search-string
An expression that specifies the string that is to be searched for.

The expression can be specified by any one of:

with the restrictions that:

Note that these rules are the same as those for the pattern-expression described in LIKE Predicate.

Both search-string and source-string have zero or more contiguous positions. If the strings are character or binary strings, a position is a byte. If the strings are graphic strings, a position is a graphic (DBCS) character.

The POSSTR function accepts mixed data strings. However, POSSTR operates on a strict byte-count basis, oblivious to changes between single and multi-byte characters.

The following rules apply:

Example


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]