ABS

The ABS function returns the absolute value of the input argument.

Syntax

ABS (argument)

Remarks

The table lists the valid input argument data types and the resulting output data types.

Data Type of Argument

Output Type

BIGINT, DECIMAL, FLOAT, INTEGER, NUMERIC, REAL, SMALLINT, TINYINT

Same as the input argument.

NULL

NULL

INTERVAL

INTERVAL
ABS (- INTERVAL '1' DAY) = INTERVAL '1' DAY

Example

SELECT ABS(-4);
SELECT ABS(4);

The result in either case is 4.