Previous Topic: FixNext Topic: Initial Uppercase


Index

The index function returns the starting position of a specified string within a string value. If the specified string is not found, a zero is returned.

Syntax:

►►─┬─ INDX ─────────┬─ (string, search-string) ───────────────────────────────►◄
   ├─ INDEX ────────┤
   └─ STRING-INDEX ─┘

Invocation names:

INDX
INDEX
STRING-INDEX

Parameters:

string

Specifies the string that is searched.

search-string

Specifies the string that the index function searches for within string. Search-string cannot be longer than string.

Example:

This example lists invoices where the product code contains the string 'ABC':

select * from invoice where index(prod-code,'abc') ne 0

  1

The above select returns all rows whose product code contains the literal, 'abc', somewhere in the string. For instance, the search strings 'ABCDEF' and 'XXXABC' produce success; 'CBAXXX' does not.