Purpose
You can call this function to return the result of a number raised to a power.
Syntax
POWER (x, y)
Parameters
| Parameter | Description |
|---|---|
| x | The base. It can be an expression of any numeric data type, for example, NUMBER, FLOAT, BINARY_FLOAT, or BINARY_DOUBLE. |
| y | The exponent. It can be any expression of the numeric data type, for example, NUMBER, FLOAT, BINARY_FLOAT, or BINARY_DOUBLE. If x is negative, y must be an integer. |
Return type
When any parameter 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