ABS()

Documentation

VoltDB Home » Documentation » Using VoltDB

ABS()

ABS() — Returns the absolute value of a numeric expression.

Synopsis

ABS( numeric-expression )

Description

The ABS() function returns the absolute value of the specified numeric expression.

Example

The following example sorts the results of a SELECT expression by its proximity to a target value (specified by a placeholder), using the ABS() function to normalize values both above and below the intended target.

SELECT price, product_name FROM product_list
    ORDER BY ABS(price - ?) ASC;