I need to assign many date value based on one date value by incrementing the date.
Following code is a sample. but it throws error. where i am wrong kindly advice.
DECLARE
issuedate date:='27-JAN-12';
issuedate_1 date;
issuedate_2 date;
issuedate_3 date;
BEGIN
for cnt in 1..5
loop
issuedate_||cnt := issuedate+cnt;
DBMS_OUTPUT.PUT_LINE(cnt);
DBMS_OUTPUT.PUT_LINE( issuedate_1);
DBMS_OUTPUT.PUT_LINE( issuedate_2);
DBMS_OUTPUT.PUT_LINE( issuedate_3);
end loop;
END;
you can’t form the variable name dynamically, create array of dates and increment and assign values.
TRY THIS LINK
issuedate_||cnt := issuedate+cnt;–problem is in BOLD part
Sample :
output: