Skip to main content

ABS

A mathematical function that returns the absolute (positive) value of the specified numeric expression. (ABS changes negative values to positive values. ABS has no effect on zero or positive values.)

Syntax

ABS ( numeric_expression )

Return Type

Returns the same type as the numeric_expression.

Examples

Examples in this section use the example blockchain.

This example shows the results of using the ABS function on two columns.

SELECT ABS(integer), ABS(real) FROM example;

Response:

ABS(integer) [INT32]    ABS(real) [FLOAT32]
1 NULL
0 0
1 1
2 2