POWER
The POWER
function returns Base
raised to the Exponent
power. The Base
and Exponent
can be any numbers, but if the Base
is negative, the Exponent
must be an integer.
SQL syntax
POWER (Base
,Exponent
)
Parameters
POWER
has the parameters:
Parameter | Description |
---|---|
|
Operand or column can be any numeric type. |
|
Operand or column can be any numeric type. If |
Description
If either Base
or Exponent
is of type BINARY_FLOAT
or BINARY_DOUBLE
, the data type returned is BINARY_DOUBLE
. If the Base
is of type NUMBER
and the Exponent
is not of type BINARY_FLOAT
or BINARY_DOUBLE
, the date type returned is NUMBER
with maximum precision and scale. If Base
is one of the TT* numeric types (TT_BIGINT
, TT_INTEGER
, TT_SMALLINT
, or TT_TINYINT
), the data type returned is BINARY_DOUBLE
.
Example
Use the POWER
function to return the commission_pct
squared for the employee with employee_id
equal to 145.
Command> SELECT employee_id, commission_pct FROM employees WHERE employee_id = 145; < 145, .4 > 1 row found. Command> SELECT POWER (commission_pct,2) FROM employees WHERE employee_id = 145; < .16 > 1 row found.