ABS()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Enterprise Server
Topics on this page:
Overview
Returns the absolute (non-negative) value of the given argument.
EXAMPLES
SELECT ABS(-5), ABS(8);
+---------+--------+
| ABS(-5) | ABS(8) |
+---------+--------+
| 5 | 8 |
+---------+--------+
Out-of-Range
A value is considered "out-of-range" when it is too small or too large to be stored in a data type. When SQL_MODE
is strict (the default) an out-of-range value generates an error. If strict mode is not in effect, the value is rounded to the nearest valid value and a warning is generated (which might be hidden, depending on your warning settings). The data type of result of ABS()
is derived from the argument type, which could result an out of range error as in example:
SELECT ABS(-9223372036854775808);
ERROR 1690 (22003): BIGINT value is out of range in 'abs(-9223372036854775808)'
CHANGE HISTORY
EXTERNAL REFERENCES
Additional information on this topic may be found in the MariaDB Public Knowledge Base.