ABS()
This page is part of MariaDB's SkySQL Documentation.
The parent of this page is: Functions
Topics on this page:
Overview
Returns the absolute (non-negative) value of the given argument.
See also: Functions in 10.6 ES, in 10.5 ES, and in 10.4 ES
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
Release Series | History |
---|---|
10.6 Enterprise |
|
10.5 Enterprise |
|
10.4 Enterprise |
|
EXTERNAL REFERENCES
Additional information on this topic may be found in the MariaDB Public Knowledge Base.
This page shows information specific to MariaDB SkySQL. Information for non-SkySQL use can be found on the ABS() page in the MariaDB Enterprise Documentation.