Oracle ha un last_day()
funzione:
SELECT LAST_DAY(to_date('04/04/1924','MM/DD/YYYY')) from dual;
SELECT LAST_DAY(ADD_MONTHS(to_date('04/04/1924','MM/DD/YYYY'), -1)) from dual;
SELECT LAST_DAY(ADD_MONTHS(to_date('04/04/1924','MM/DD/YYYY'), -2)) from dual;
Risultati:
April, 30 1924 00:00:00+0000
March, 31 1924 00:00:00+0000
February, 29 1924 00:00:00+0000
Usa Add_Months()
alla data per ottenere il mese appropriato, quindi applicare last_day()
.