8.4.1 ABS
Returns the absolute value of the target data.
- Organization of this subsection
(1) Specification format
scalar-function-ABS ::= ABS(target-data) target-data ::= value-expression
(2) Explanation of specification format
- target-data:
-
Specifies the numeric data whose absolute value is to be determined.
The following rules apply:
-
Specify the target data in the form of a value expression. For details about value expressions, see 7.20 Value expression.
-
Specify numeric data for the target data. For details about numeric data, see (1) Numeric data in 6.2.1 List of data types.
-
You cannot specify a dynamic parameter by itself for the target data.
-
(3) Rules
-
The data type and data length of the execution result will be the data type and data length of the target data.
-
If the execution results cannot be represented in the data type of the target data, an overflow error is generated.
-
The NOT NULL constraint does not apply to the value of the execution result (the null value is allowed).
-
If the target data has the null value, the execution result will be a null value.
(4) Example
- Example:
-
Determine the absolute values of the values in columns C1 to C3 in table T1.
SELECT ABS("C1"),ABS("C2"),ABS("C3") FROM "T1"