Functions : Functions are pre-defined programs which returns always one value
Types of Functions: 1. Single Row Functions 2. Group Functions
Single Row Functions : The function which acts on each and every row.
Types of single row functions
- Characters / String Functions
- Numbers Functions
- Date functions
- Conversion Functions
Date Functions
Date Functions : Function which will return a value from the date
SQL> select sysdate from dual;
SYSDATE
24-APR-15
SQL> select next_day(sysdate,’monday’) from dual;
NEXT_DAY(
27-APR-15
SQL> select next_day(sysdate,’friday’) from dual;
NEXT_DAY(
01-MAY-15
sq> select months_between(’01-oct-2015′,’01-feb-2014′) from dual
MONTHS_BETWEEN(’01-OCT-2015′,’01-FEB-2014′)
20
SQL> select greatest(’01-jan-2015′,’01-oct-2015′) from dual;
GREATEST(‘0
01-oct-2015
SQL> select months_between(sysdate,’01-feb-2014′) from dual;
MONTHS_BETWEEN(SYSDATE,’01-FEB-2014′)
14.7541767
SQL> select last_day(sysdate) from dual;
LAST_DAY(
30-APR-15
SQL> select last_day(’01-may-2015′)
2 from dual;
LAST_DAY(
31-MAY-15