SQL>
SQL>
SQL> declare
2 l_hiredate timestamp := to_timestamp('1996-11-04 07:00:00','YYYY-MM-DD HH24:MI:SS');
3 l_oneyr interval year to month := to_yminterval('01-00');
4 l_18mos interval year to month := to_yminterval('01-06');
5 l_threeyrs interval year to month := to_yminterval('03-00');
6 l_fiveyrs interval year to month := to_yminterval('05-00');
7 begin
8 dbms_output.put_line('One Year: '||(l_hiredate + l_oneyr));
9 dbms_output.put_line('One + 1/2 Year: '||(l_hiredate + l_oneyr));
10 dbms_output.put_line('Three Years: '||(l_hiredate + l_threeyrs));
11 dbms_output.put_line('Five Years: '||(l_hiredate + l_fiveyrs));
12 end;
13 /
One Year: 04-NOV-97 07.00.00.000000000 AM
One + 1/2 Year: 04-NOV-97 07.00.00.000000000 AM
Three Years: 04-NOV-99 07.00.00.000000000 AM
Five Years: 04-NOV-01 07.00.00.000000000 AM
PL/SQL procedure successfully completed.
SQL>
SQL> --
|