ABS
The ABS
function returns the absolute value of Expression.
SQL syntax
ABS(Expression)
Parameters
ABS
has the parameter:
Parameter | Description |
---|---|
|
Operand or column can be any numeric data type. Absolute value of |
Description
-
If
Expression
is of typeNUMBER
, the data type returned isNUMBER
with maximum precision and scale. Otherwise,ABS
returns the same data type as the numeric data type ofExpression
. -
If the value of
Expression
isNULL
,NULL
is returned. If the value of theExpression
is-INF
,INF
is returned.
Examples
Create table abstest
and define columns with type BINARY_FLOAT
and TT_INTEGER
. Insert values -BINARY_FLOAT_INFINITY
and -10. Call ABS
to return the absolute value. You see INF
and 10 are the returned values:
Command> CREATE TABLE abstest (col1 BINARY_FLOAT, col2 TT_INTEGER); Command> INSERT INTO abstest VALUES (-BINARY_FLOAT_INFINITY, -10); 1 row inserted. Command> SELECT ABS (col1) FROM abstest; < INF > 1 row found. Command> SELECT ABS (col2) FROM abstest; < 10 > 1 row found.