NULLEQ()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns a boolean indicating if two values are equivalent, even NULL
values.
USAGE
NULLEQ(value, value)
Argument Name | Description |
---|---|
| The two values to compare |
DETAILS
NULLEQ()
is a function that returns 1
or 0
to indicate if two values are equivalent.
If at least one argument is a number, a numeric comparison is performed. Thus, a string argument is converted into a number when paired with a numeric argument.
When both arguments are strings, the comparison takes into account the current sort order, which might treat uppercase and lowercase letters as equivalent. For a function that does not ignore case, see IDENTICAL().
The return value is 1
if the two arguments are equal.
The return value is 0
if the two arguments are not equal.
Comparing a NULL
value returns a normal boolean integer, with NULL
only matching another NULL
.
See also EQ().
EXAMPLES
SELECT NULLEQ(99, 123),
NULLEQ(PI(), 3.141592653589793) AS pi_eq;
+-----------------+-------+
| NULLEQ(99, 123) | pi_eq |
+-----------------+-------+
| 0 | 1 |
+-----------------+-------+
-- Disable strict mode or the select might throw an error
SET sql_mode = '';
SELECT NULLEQ(99, '99a'), NULLEQ('abc', 0);
+-------------------+------------------+
| NULLEQ(99, '99a') | NULLEQ('abc', 0) |
+-------------------+------------------+
| 1 | 1 |
+-------------------+------------------+
SELECT NULLEQ(5, NULL), NULLEQ(NULL, NULL);
+-----------------+--------------------+
| NULLEQ(5, NULL) | NULLEQ(NULL, NULL) |
+-----------------+--------------------+
| 0 | 1 |
+-----------------+--------------------+