INSTR()

Overview

Returns the position of the first occurrence of a substring in another string.

USAGE

INSTR(search_string, substring)

Argument Name

Description

search_string

The string to search

substring

The substring to find

DETAILS

INSTR() is a string function that returns the position of the first occurrence of substring in the search_string.

The returned value is a 1-relative position when the substring is found or 0 when it is not.

A NULL is returned if any argument is NULL.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT INSTR('mariadb', 'a');
+-----------------------+
| INSTR('mariadb', 'a') |
+-----------------------+
|                     2 |
+-----------------------+
SELECT INSTR('mariadb', 'ad');
+------------------------+
| INSTR('mariadb', 'ad') |
+------------------------+
|                      5 |
+------------------------+
SELECT INSTR('mariadb', 'x');
+-----------------------+
| INSTR('mariadb', 'x') |
+-----------------------+
|                     0 |
+-----------------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES