INTERVAL()
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 index of the last argument that is less than the first argument or is NULL.
USAGE
INTERVAL(find, number[, number] ...)
Argument Name | Description |
---|---|
| The number that is being compared against the list |
| One or more numeric arguments that are compared against |
DETAILS
INTERVAL()
is a comparison function that returns the index of the last argument whose value is less than the first argument.
A -1
is returned if the first argument is NULL
.
INTERVAL()
requires arguments to be integers, and for non integer arguments generates a Warning : "Truncated incorrect DOUBLE value".
EXAMPLES
SELECT INTERVAL(1, 2, 4, 6, 8) AS result1,
INTERVAL(4, 2, 4, 6, 8) AS result2,
INTERVAL(9, 2, 4, 6, 8) AS result3;
+---------+---------+---------+
| result1 | result2 | result3 |
+---------+---------+---------+
| 0 | 2 | 4 |
+---------+---------+---------+
SELECT INTERVAL(NULL, 2, 4, 6, 8) AS result;
+--------+
| result |
+--------+
| -1 |
+--------+