POSITION function returns the position (integer number) of a substring in a string.
Quick Example:
Find position of word Jose in string San Jose:
SELECT POSITION('Jose' IN 'San Jose'); -- Result: 5
Summary information:
| Syntax | POSITION(substring IN string) | |
| When Not Found | Returns 0 when substring is not found in string | |
| Returns NULL | If string or substring is NULL | |
| Alternatives | INDEX function that is Teradata extension | Different order of parameters |
| ANSI SQL | POSITION function is ANSI SQL compliant | |
Related Functions:
| INDEX | Get Position of Substring in String | Different order of parameters |
Last Update: Teradata 13.0
Defining the position of a substring in other databases:
Oracle:
| INSTR(string, substring [,position [, occurrence]]) | Different order of parameters |
| Allows specifying position and occurrence |