navigation

NUMERIC FUNCTIONS

Abs :
This function is used to convert any negative expression into positive
Syntax : Abs (Numeric Expression)
Example :  Select abs(-100) from Dual ;
RESULT: 100
Select abs(300-500) from Dual ;
 RESULT: 200
Select abs(-20*30) from Dual ;
RESULT:  600
Exp (Exponential) :
This Function is used to find the exponential value for the given number. I.e. “e” to the power of “x“ value ( ex). where ‘e’ has a constant value i.e. 2.7182
Syntax:  Exp(Numeric Expression)
Example: Select exp(0) from Dual ;
RESULT:  1
Select exp(1) from Dual ;
RESULT:  2.7182
Select exp(2) from Dual ;
RESULT:  7.3890
Sqrt (Square Root):
This function is used to find the square root value for the given number
Syntax: Sqrt ( Number )
Example: select sqrt(2) from dual ;
RESULT:  1.4142
select sqrt(16) from dual ; RESULT:  4
select sqrt(sal) from emp;
select sqrt(4*sqrt(2)) from dual;
Power:
This function is used to find the power value i.e. x to the power of y value
Syntax: Power(x, y)
Example: select power(2,3) from dual ;
RESULT:  8
select power(5,3) from dual ;
RESULT:  125
select power(sal,2) from emp;
Round :
This function is used to round off the given numeric expression according to
specified length or precision
Syntax : Round(Numeric Expression, Length)
Example : select round(98.52) from dual;
 RESULT:  99
Select round(65.567,1) from dual ;
RESULT:  65.6
Select round(65.567,2) from dual ;
RESULT:  65.57
Ceil :
This function returns the nearest integer greater than the given numeric expression
Syntax :Ceil(Numeric Expression)
Example : Select ceil(-23.567) from dual ;
RESULT:  -23
Select ceil(23.567) from dual ;
RESULT:  24
Floor :
This function returns the nearest integer smaller than the given numeric expression
Syntax: Floor(Numeric Expression)
Example: Select floor(-23.567) from dual ;
RESULT:  -24
Select floor(23.567) from dual ;
RESULT:  23
Log :
this function is used to find the logarithm value for the given number and for the given base
Syntax : Log(Number, Base Value)
Example : select log(10,10) from dual;
RESULT:  1
select log(2,10) from dual;
RESULT:  3.3219

No comments:

Post a Comment