SELECT (P.PERIOD_NAME) PERIOD_NAME,
TO_CHAR(P.START_DATE, 'YYYY-MM-DD') PERIOD_START,
TO_CHAR(P.END_DATE, 'YYYY-MM-DD') PERIOD_END
FROM GL_PERIODS P, GL_LEDGERS B, GL_PERIOD_STATUSES S
WHERE P.PERIOD_SET_NAME = B.PERIOD_SET_NAME
AND B.LEDGER_ID = S.LEDGER_ID
AND S.CLOSING_STATUS = 'O'
AND S.APPLICATION_ID = 101
AND S.PERIOD_NAME = P.PERIOD_NAME
ORDER BY PERIOD_END DESC;