The POWER function in Oracle SQL / PLSQL is used to get ‘m’ raised to the power of ‘n’.
Syntax for the POWER function in Oracle SQL / PLSQL is:
SELECT POWER(m,n)
FROM table_name;
- M is the number to be raised or base
- N is the number up to which base is to be raised or exponent
Example 1:
SELECT POWER(2,2) FROM DUAL;
Will return “4” because 2*2 = 4
Example 2:
SELECT POWER(2,3) FROM DUAL;
Will return “8” because 2*2*2 = 8
Example 3:
SELECT POWER(5,3) FROM DUAL;
Will return 125 as 5*5*5 = 125
.
Example 4:
SELECT POWER(5,-3) FROM DUAL;
Will return 0.008 as 1/(5*5*5) = 0.008