INDEXC Function

Searches a character expression for specified characters and returns the position of the first occurrence of any of the characters.

Category: Character
Returned data type: DOUBLE

Syntax

Arguments

target-expression

specifies any valid expression that evaluates to a character string that is searched.

Data type NCHAR
See <sql-expression>
FedSQL Expressions

search-expression

specifies the characters to search for in target-expression.

Data type NCHAR
Tip Enclose a literal string of characters in single quotation marks.
See <sql-expression>
FedSQL Expressions

Details

The INDEXC function searches target-expression, from left to right, for the first occurrence of any character present in the search expressions and returns the position in target-expression of that character. If none of the characters in the search expressions are found in target-expression, INDEXC returns a value of 0.

Comparisons

The INDEXC function searches for the first occurrence of any individual character that is present within the search expression, whereas the INDEX function searches for the first occurrence of the search expression as a pattern.

Example

The following statement illustrates the INDEXC statement:
Statements
Results
select indexc('aabb','ab');
1

See Also

Functions:
Last updated: February 23, 2017