POWER Function in Oracle SQL – PLSQL

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:

[sourcecode language=”sql”]
SELECT POWER(2,2)
FROM DUAL; [/sourcecode]

Will return “4” because 2*2 = 4


Example 2:

[sourcecode language=”sql”]
SELECT POWER(2,3)
FROM DUAL; [/sourcecode]

Will return “8” because 2*2*2 = 8


Example 3:

[sourcecode language=”sql”]
SELECT POWER(5,3)
FROM DUAL; [/sourcecode]

Will return 125 as 5*5*5 = 125


.

Example 4:

[sourcecode language=”sql”]
SELECT POWER(5,-3)
FROM DUAL; [/sourcecode]

Will return 0.008 as 1/(5*5*5) = 0.008


Leave a Reply

Your email address will not be published. Required fields are marked *