ELT()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns the string that corresponds to the given numeric position in a list of strings.
USAGE
ELT(position, expr[, expr] ...)
Argument Name | Description |
|---|---|
| The index or numeric position to return from the list of expressions |
| One or more comma-separated strings |
DETAILS
ELT() is a string function that returns the string that corresponds to the given numeric position in a list of strings.
The first argument is the 1-relative index for the desired string.
A non-string expr argument is converted to a string, if possible.
It is valid to specify a NULL for an expr argument as long as you want that index position to return NULL.
A NULL is returned if the first argument is NULL, less than 1, or greater than the number of expr arguments provided.
EXAMPLES
SELECT ELT(1, '1a', '2b', '3c', '4d', '5e');
+--------------------------------------+
| ELT(1, '1a', '2b', '3c', '4d', '5e') |
+--------------------------------------+
| 1a |
+--------------------------------------+
SELECT ELT(5, '1a', '2b', '3c', '4d', '5e');
+--------------------------------------+
| ELT(5, '1a', '2b', '3c', '4d', '5e') |
+--------------------------------------+
| 5e |
+--------------------------------------+
SELECT ELT(6, '1a', '2b', '3c', '4d', '5e');
+--------------------------------------+
| ELT(6, '1a', '2b', '3c', '4d', '5e') |
+--------------------------------------+
| NULL |
+--------------------------------------+
