Teradata - INDEX Function - Get Position of Substring in String

INDEX function returns the position (integer number) of a substring in a string.

Quick Example:

Find position of word York in string New York:

   SELECT INDEX('New York', 'York');
   -- Result: 5

INDEX Overview

Summary information:

Syntax INDEX(string, substring)
When Not Found Returns 0 when substring is not found in string
Returns NULL If string or substring is NULL
Alternatives POSITION function ANSI SQL compliant Different order of parameters

Related Functions:

POSITION Get Position of Substring in String ANSI SQL compliant Different order of parameters

Last Update: Teradata 13.0

Teradata INDEX in Other Databases

Defining the position of a substring in other databases:

Oracle:

INSTR(string, substring [,position [, occurrence]]) Allows specifying the start position for search and occurrence

Teradata Resources