Oracle POWER() Function

Oracle POWER(x, y) is a built-in function that returns the y power of x.

Oracle POWER() syntax

Here is the syntax for the Oracle POWER() function:

POWER(num)

Parameters

x

Required. The number.

y

Required. The power.

x and y can be any numeric data type or any non-numeric data type that can be implicitly converted to a numeric data type.

Return Value

The Oracle POWER(x, y) function returns the y power of x.

ATAN2() returns BINARY_DOUBLE if any parameter is BINARY_FLOAT or BINARY_DOUBLE. Otherwise ATAN2() returns NUMBER.

If any parameter is NULL, POWER() will return NULL.

Oracle POWER() Examples

Here are some examples that demonstrate the usage of the Oracle POWER() function.

Basic Usage

This statement uses Oracle POWER() to calculate the square of 4.

SELECT
    POWER(4, 2)
FROM dual;

Output:

   POWER(4,2)
_____________
           16

NULL Parameters

If any parameter is NULL, POWER() will return NULL.

SET NULL 'NULL';
SELECT
    POWER(1, NULL),
    POWER(NULL, 1),
    POWER(NULL, NULL)
FROM dual;

Output:

   POWER(1,NULL)    POWER(NULL,1)    POWER(NULL,NULL)
________________ ________________ ___________________
            NULL             NULL                NULL

In this example, we use the statement SET NULL 'NULL'; to display NULL values as the string 'NULL'.

Conclusion

Oracle POWER(x, y)is a built-in function that returns x to y the power of .