Purpose
POWER() returns the result of a number raised to a specified power.
Syntax
POWER(x,y)
Parameters
| Parameter | Description |
|---|---|
| x | The base. It can be an expression of any numeric data type, such as NUMBER, FLOAT, BINARY_FLOAT, or BINARY_DOUBLE. |
| y | The exponent. It can be an expression of any numeric data type, such as NUMBER, FLOAT, BINARY_FLOAT, or BINARY_DOUBLE. If x is negative, y must be an integer. |
Return type
When any argument is of the BINARY_FLOAT or BINARY_DOUBLE data type, the return type is BINARY_DOUBLE. Otherwise, the return type is NUMBER.
Examples
The following example returns 3 squared, -3 cubed, and 4 to the power of -2.
obclient> SELECT POWER(3,2),POWER(-3,3),POWER(4,-2) FROM DUAL;
+------------+-------------+-------------+
| POWER(3,2) | POWER(-3,3) | POWER(4,-2) |
+------------+-------------+-------------+
| 9 | -27 | .0625 |
+------------+-------------+-------------+
1 row in set