Hitachi

Hitachi Advanced Database SQL Reference


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:

exponent:

Specifies the exponent.

The following rules apply:

(3) Rules

  1. The data type of the execution result is the DOUBLE PRECISION type.

  2. If the execution result cannot be represented in the DOUBLE PRECISION type, an overflow error is generated.

  3. The NOT NULL constraint does not apply to the value of the execution result (the null value is allowed).

  4. If either the target data or exponent has a null value, the execution result will be a null value.

  5. If you specify a negative value for the target data, you must specify an integer for the exponent.

  6. 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"

[Figure]

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"

[Figure]