Wednesday, 8 July 2015

YTD Opening Date Wise

SELECT CASE
          WHEN TO_DATE (:psdate) <
                             TO_DATE ('01-APR-' || SUBSTR (:psdate, 8, 4))
             THEN    '01-APR-'
                  || TO_CHAR (TO_NUMBER (SUBSTR (:psdate, 8, 4)) - 1)
          ELSE '01-APR-' || SUBSTR (:psdate, 8, 4)
       END CURRENT_YTD
FROM DUAL;

No comments:

Post a Comment