STRPOS

Returns an INTEGER value representing the character location of a specified substring within a string (counting from one).

Behavior Type

Immutable

Syntax

STRPOS ( string , substring )

Parameters

string

(CHAR or VARCHAR) is the string in which to locate the substring

substring

(CHAR or VARCHAR) is the substring to locate

Notes

STRPOS is similar to POSITION although POSITION allows finding by characters and by octet.

If the string is not found, the return value is zero.

Examples

=> SELECT STRPOS('abcd', 'c');
 STRPOS
--------
      3
(1 row)