| Oracle® TimesTen In-Memory Database SQL Reference Release 11.2.1 Part Number E13070-04 |
|
|
View PDF |
The ABS function returns the absolute value of Expression.
SQL syntax
ABS(Expression)
Parameters
ABS has the parameter:
| Parameter | Description |
|---|---|
Expression |
Operand or column can be any numeric data type. Absolute value of Expression is returned. |
Description
If Expression is of type TT_DECIMAL or NUMBER, the data type returned is NUMBER with maximum precision and scale. Otherwise, ABS returns the same data type as the numeric data type of Expression.
If the value of Expression is NULL, NULL is returned. If the value of the Expression 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.