Showing posts with label oracle pl/sql date. Show all posts
Showing posts with label oracle pl/sql date. Show all posts

Thursday, April 9, 2009

Fiddling with DATES

1. Selecting current date
SELECT SYSDATE FROM DUAL;

2. Adds one day to current date
SELECT SYSDATE+1 FROM DUAL;

3. Adding months
SELECT ADD_MONTHS(SYSDATE,2) FROM DUAL;

4. TRUNC
It truncates the time part from the date TRUNC(SYSDATE).

5. MONTHS_BETWEEN( date1, date2 )
Gives the number of months between two dates.