Search This Blog

Wednesday, September 27, 2017

LAST DATE OF YEAR, FIRST DAY OF YEAR, FIRST FRIDAY OF YEAR, SECOND FRIDAY OF YEAR IN ORACLE SQL


SELECT ADD_MONTHS (TRUNC (SYSDATE, 'YEAR'), 12) - 1 "LAST DATE OF YEAR"
  FROM DUAL;

SELECT TRUNC (SYSDATE, 'YEAR') "FIRST DAY OF YEAR" FROM DUAL;

SELECT NEXT_DAY (TRUNC (SYSDATE, 'YEAR'), 'FRIDAY') "FIRST FRIDAY OF YEAR"
  FROM DUAL;


SELECT NEXT_DAY (NEXT_DAY (TRUNC (SYSDATE, 'YEAR'), 'FRIDAY'), 'FRIDAY')
          "SECOND FRIDAY OF YEAR"
  FROM DUAL;

No comments:

Post a Comment

PDF to Text Covert by Oracle Apex

Here are the steps to convert and get the character into a region by Oracle Apex. Step1.  Create a page and Copy-Pest the below code into Pa...