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.) ().
Sample Source Pattern
Syntax
ABS( expression )
ABS( <num_expr> )
Math.abs( expression )
Examples
Code:
IN -> SqlServer_01.sql
SELECT ABS(-5);
Result:
ABS(-5)|
-------+
5|
Code:
OUT -> SqlServer_01.sql
SELECT ABS(-5);
Result:
ABS(-5)|
-------+
5|
Code:
CREATE OR REPLACE FUNCTION compute_abs(a float)
RETURNS float
LANGUAGE JAVASCRIPT
AS
$$
return Math.abs(A);
$$
;
SELECT COMPUTE_ABS(-5);