SELECT
TRUNC(MONTHS_BETWEEN(LEAST(NVL(:P_TO_DATE,SYSDATE),SYSDATE), NVL(:START_DATE,:START_DATE))/12) "YEARS"
,TRUNC(MONTHS_BETWEEN(LEAST(NVL(:P_TO_DATE,SYSDATE),SYSDATE), NVL(:START_DATE,:START_DATE))) - TRUNC(MONTHS_BETWEEN(LEAST(NVL(:P_TO_DATE,SYSDATE),SYSDATE), NVL(:START_DATE,:START_DATE))/12)*12 "MONTHS"
,TRUNC((MONTHS_BETWEEN (LEAST(NVL(:P_TO_DATE,SYSDATE),SYSDATE),NVL(:START_DATE,:START_DATE)) - TRUNC(MONTHS_BETWEEN(LEAST(NVL(:P_TO_DATE,SYSDATE),SYSDATE), NVL(:START_DATE,:START_DATE)))) * 30 ) "DAYS"
from dual
No comments:
Post a Comment