Power function Oracle

Power(m,n) function returns m raised to n. It is an example of Numeric function

Syntax :-

Power(m,n)

Examples:-

SQL> select power(2,3) from dual;

POWER(2,3)
———-
8

SQL> select power(2,-3) from dual;

POWER(2,-3)
———–
.125

SQL> select power(2,0) from dual;

POWER(2,0)
———-
1

SQL> select power(2.2,2) from dual;

POWER(2.2,2)
————
4.84

Note :- Inside PL/SQL power(2,3) can be written also as 2**3

declare
n integer;
m integer;
begin
n := power(2,3);
dbms_output.put_line(‘n = ‘ || n);
m := 2**3;
dbms_output.put_line(‘m = ‘ || m);
end;

/

n = 8
m = 8

Advertisements

Author: sqlandplsql

To learn more about the Oracle, SQL, PL SQL, Performance Tuning, Database Modeling, Ubuntu, MySQL etc .Suggestions, comments, feedbacks and referrals are highly appreciated.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s