Week-4a Built in Functions
Week-4a Built in Functions
Numeric Functions
Date Functions
Conversion Functions
2-The Built-in Numeric Functions
Name Description
ABS Returns the absolute value of the number.
CEIL Returns the smallest integer greater than or equal to the specified
number.
FLOOR Returns the largest integer equal to or less than the specified
number.
EXP (n) Returns e raised to the nth power, where e = 2.71828183...
CEIL
The CEIL ("ceiling") function returns the smallest integer greater than or equal to the
specified number.
FLOOR
he FLOOR function, the opposite of the CEIL function, returns the largest integer that is less
than or equal to the input number.
EXP(N) eN
The number e (approximately equal to 2.71828) is the base of the system of natural logarithms
ASIN(0.5) 0,523598775598299
ACOS
ACOS(0,866025403784439) 0,523598775598299
LN
The LN function returns the natural logarithm of the input. The specification for the LN function is:
LOG
The LOG function returns the base-b logarithm of the input value.
MOD
The MOD function returns the remainder of one number when divided by a second number.
POWER NM POWER(N,M)
The POWER function raises the first argument to the power indicated by the second argument.
SIGN
The SIGN function returns the sign of the input number.
SQRT
The SQRT function returns the square root of the input number.
SQRT(25) 5
TRUNC
The TRUNC function truncates the first argument to the number of decimal places specified by the
second argument.
Name Description
LAST_DAY
LAST_DAY ('12-JAN-99') 31-JAN-1999
MONTHS_BETWEEN
MONTHS_BETWEEN ('31-MAR-1995', '28-FEB-1994‘) 13
SYSDATE
Display the current date
4-The Built-In Conversion Functions
Name Description
USER USER function returns the user_id from the current Oracle session.
SELECT USER FROM DUAL; >>>>> SCOTT
UID function returns the id number for a user's session (the user who is
UID currently
logged in).
SELECT UID FROM DUAL; >>>>> 54
COALESCE The coalesce function returns the first non-null expression in the list. If all
expressions evaluate to null, then the coalesce function will return null.
f )a sin(0.5) g ) cos(450 )
sin 30
h) tan 2 45 log3 600 ln 6 812
cos 70
2-Write an SQL statement which returns