POSITION()

Documentation

VoltDB Home » Documentation » Using VoltDB

POSITION()

POSITION() — Returns the starting position of a substring in another string.

Synopsis

POSITION( substring-expression IN string-expression )

Description

The POSITION() function returns the starting position of a substring in another string. The position, if a match is found, is an integer number between one and the length of the string being searched. If no match is found, the function returns zero.

Example

The following example selects all books where the title contains the word "poodle" and returns the book's title and the position of the substring "poodle" in the title.

SELECT Title, POSITION('poodle' IN Title) FROM Books
    WHERE Title LIKE '%poodle%'  ORDER BY Title;
>