input a date and an year number
I want to input a date and an year number in integer want the below output.
--10 is year as input
--30-Sep-2017 is input date (I need 30-sep-2017,30-Sep-2016,30-Sep-2015 till the number of year i.e. 10 in this case )
CREATE OR REPLACE PROCEDURE XXHRS_FB_DATES(P_START_DATE DATE,P_NUMBER_YEARS NUMBER)
AS
L_START_DATE DATE:=P_START_DATE;
L_RETRIVE_DATA DATE;
BEGIN
SELECT ADD_MONTHS(L_START_DATE,12) INTO L_RETRIVE_DATA FROM DUAL;
FOR LION IN 1..P_NUMBER_YEARS LOOP
DBMS_OUTPUT.PUT_LINE(L_RETRIVE_DATA);
L_RETRIVE_DATA :=ADD_MONTHS(L_RETRIVE_DATA,-12);
END LOOP;
END;
EXEC XXHRS_FB_DATES('15-JAN-2018',5)
No comments:
Post a Comment