02 August, 2019

Add year, Month and Day to date in Oracle

I've found that this works on 9.2.0.1 and later -

YEAR:
select sysdate + interval '1' year from dual
--Which return current date plus one year
Sysdate =01/01/2018(dd/mm/yyyy) Output: 01/01/2019
MONTH:
select sysdate + interval '1' month from dual
--Which return current date plus one Month
Sysdate =01/01/2018(dd/mm/yyyy) Output: 01/02/2018
DAY:
select sysdate + interval '1' day from dual
--Which return current date plus one day
Sysdate =01/01/2018(dd/mm/yyyy) Output: 02/01/2018

No comments:

Post a Comment