Blackhawks4Life
Programmer
I created the following function, and I pass in the year 2013. I expected the function to return '02-JAN-13', but it is still returning '01-JAN-13'. What am I missing?
I am using Toad for Oracle, on Oracle 11G. Thank you in advance for the assistance.
CREATE OR REPLACE FUNCTION COV_OBJECTS.GET_HOLIDAY_DATES ( P_YEAR IN INT ) RETURN VARCHAR2
IS
P_NEW_YEARS DATE;
BEGIN
SELECT TO_DATE('01-JAN-' || TO_CHAR(P_YEAR),'DD-MON-YYYY') INTO P_NEW_YEARS FROM DUAL;
IF UPPER(TO_CHAR(P_NEW_YEARS,'DAY')) = 'TUESDAY' THEN
SELECT P_NEW_YEARS + 1 INTO P_NEW_YEARS FROM DUAL;
END IF;
RETURN P_NEW_YEARS;
END ;
I am using Toad for Oracle, on Oracle 11G. Thank you in advance for the assistance.
CREATE OR REPLACE FUNCTION COV_OBJECTS.GET_HOLIDAY_DATES ( P_YEAR IN INT ) RETURN VARCHAR2
IS
P_NEW_YEARS DATE;
BEGIN
SELECT TO_DATE('01-JAN-' || TO_CHAR(P_YEAR),'DD-MON-YYYY') INTO P_NEW_YEARS FROM DUAL;
IF UPPER(TO_CHAR(P_NEW_YEARS,'DAY')) = 'TUESDAY' THEN
SELECT P_NEW_YEARS + 1 INTO P_NEW_YEARS FROM DUAL;
END IF;
RETURN P_NEW_YEARS;
END ;