Name

POWER

Use POWER to raise a number to a specific value.

ANSI SQL Standard Syntax

All platforms support the ANSI SQL syntax:

POWER( base, exponent)

The result of the POWER function is base raised to the exponent power, or baseexponent. If base is negative, exponent must be an integer.

Examples

Raising a positive number to an exponent is straightforward:

SELECT POWER(10,3) FROM dual;
POWER(10,3)
-----------
       1000

Anything raised to the 0th power evaluates to 1:

SELECT POWER(0,0) FROM dual;
POWER(0,0)
----------
         1

Negative exponents move the decimal point to the left:

SELECT POWER(10,−3) FROM dual;
POWER(10,−3)
------------
        .001

Get SQL in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.