Given a date, how to find out the number of days left in the specified month?
The following query shows how to get the number of days left in the current month (SYSDATE returns January 11, 2012 in this example):
SELECT LAST_DAY(SYSDATE) - SYSDATE FROM dual; -- Result: 20
We used SYSDATE function to return the current date, but here you can use any datetime expression.
LAST_DAY function returns the last date (not just day), so in our example LAST_DAY(SYSDATE) returns January 31, 2012.
In Oracle when you subtract one datetime value from another, the result is the number of days between them, so LAST_DAY(SYSDATE) - SYSDATE returns the required number of days left in the month.
Oracle 11g Release 2 SQL Language Reference