8.3.4 POWER
Returns the result of raising the target data to a specified power.
- Organization of this subsection
(1) Specification format
scalar-function-POWER ::= POWER(target-data,exponent) target-data ::= value-expression exponent ::= value-expression
(2) Explanation of specification format
- target-data:
-
Specify the target data whose exponentiation 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.
-
- exponent:
-
Specifies the exponent.
The following rules apply:
-
Specify the exponent in the form of a value expression. For details about value expressions, see 7.20 Value expression.
-
Specify numeric data for the exponent. 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 exponent.
-
(3) Rules
-
The data type of the execution result is the DOUBLE PRECISION type.
-
If the execution result cannot be represented in the DOUBLE PRECISION type, 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 either the target data or exponent has a null value, the execution result will be a null value.
-
If you specify a negative value for the target data, you must specify an integer for the exponent.
-
If you specify 0 for the target data, you must specify a positive value for the exponent, or a divide-by-zero error will be generated.
(4) Examples
- Example 1:
-
Determine the square of the value of column C1 in table T1.
SELECT POWER("C1",2) FROM "T1"
- Example 2:
-
Determine the power of the target data, where the target data is the value of column C1 and the exponent is the value of column C2 in table T1.
SELECT POWER("C1","C2") FROM "T1"