Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / PL SQL Data Types
 

Use INTERVAL types

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')   5                           + INTERVAL '12-3' YEAR TO MONTH;   6   7     DBMS_OUTPUT.PUT_LINE('My daughter leaves for college in '   8                          ||v_college_deadline);   9  END;  10  / My daughter leaves for college in 06-SEP-16 12.00.00.000000 AM PL/SQL procedure successfully completed. SQL>