Define, syntax and an example with output for
SYSDATEReturns the current system date of the database system.
Syntax:
SYSDATE
Example:
SELECT SYSDATE FROM db_company
Output:
28-May-2010
ADD_MONTHS(Date, months_to_add)Returns the month by adding n months to the month of the date specified.
Syntax:
add_months( date1, n )
Example:
add_months('01-Aug-03', 3)
Output:
01-Nov-03
LAST_DAY(Date)Returns the last day of the date specified.
Syntax:
LAST_DAY(date1)
Example:
last_day(to_date('2003/03/15', 'yyyy/mm/dd'))
Output:
Mar 31, 2003
MONTHS_BETWEEN(Date1, Date2) Returns the number of months between date1 and date2
Syntax:
MONTHS_BETWEEN(date1,date2)
Example:
months_between (to_date ('2003/01/01', 'yyyy/mm/dd'), to_date ('2003/03/01', 'yyyy/mm/dd') )
Output:
2