SQL>
SQL>
SQL> DECLARE
2 old_date DATE;
3 curr_date DATE := SYSDATE;
4 BEGIN
5 LOOP
6 old_date := curr_date;
7 curr_date := curr_date + 1;
8 END LOOP;
9 EXCEPTION
10 WHEN OTHERS
11 THEN
12 DBMS_OUTPUT.PUT_LINE (SQLERRM);
13 DBMS_OUTPUT.PUT_LINE ('Last date: ' || TO_CHAR (old_Date, 'MM-DD-YYYY'));
14 END;
15 /
ORA-01841: (full) year must be between -4713 and +9999, and not be 0
Last date: 12-31-9999
PL/SQL procedure successfully completed.
SQL>
|