This script demonstrates the use of the INTERVAL types : INTERVAL « Data Type « Oracle PL / SQL






This script demonstrates the use of the INTERVAL types

  

SQL>
SQL>
SQL> SET SERVEROUTPUT ON

SQL>
SQL> DECLARE
  2     v_college_deadline TIMESTAMP;
  3  BEGIN
  4     v_college_deadline := TO_TIMESTAMP('06/06/2004', 'DD/MM/YYYY') + INTERVAL '12-3' YEAR TO MONTH;
  5
  6     DBMS_OUTPUT.PUT_LINE('My daughter leaves for college in ' ||v_college_deadline);
  7  END;
  8  /
My daughter leaves for college in 06-SEP-16 12.00.00.000000 AM

PL/SQL procedure successfully completed.

   
    
  








Related examples in the same category

1.Shorthand for a 101 year and 3 month interval(INTERVAL '101' YEAR)
2.Shorthand for a 101 year and 3 month interval(INTERVAL '101-3' YEAR TO MONTH)
3.Shorthand for a 101 year and 3 month interval(INTERVAL '3' MONTH)
4.INTERVAL DAY TO SECOND
5.An assignment to var2