Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: arithmetic on a DATE column?
Hello,
and from the sql manual (hint, hint, hint)
select to_char(add_months((sysdate+1), 12)) from dual;
hth,
cindy
sergio_rotstein_at_vpharm.com wrote:
> Please forgive me if this question has a blatantly obvious answer...
>
> I have a column in a table that contains dates on which I would like to
> do some arithmetic. Specifically, I would like to modify some of those
> dates by making "Date = Date + 1day + 4years". I know that an
> expression like date+1 would work to add one day to a given date, but
> how do I add the years? In my dream world I could use an expression
> like:
>
> SQL> select to_char(sysdate + to_date('1-4','D-Y')) from dual;
>
> but alas I know that doesn't work. I don't want to use an expression
> like "date + (365*4) + 1" because that doesn't correct for potential
> leap year issues...
>
> Any assistance would be most welcome.
>
> Thanks.
>
> Sergio.
>
> --
> Sergio H. Rotstein, Ph.D.
> Manager of Research Informatics
> Vertex Pharmaceuticals Incorporated
>
> --
> Sergio H. Rotstein, Ph.D.
> Manager of Discovery Information Systems
> Vertex Pharmaceuticals Incorporated
>
> --
> Sergio H. Rotstein, Ph.D.
> Manager of Discovery Information Systems
> Vertex Pharmaceuticals Incorporated
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Thu Oct 19 2000 - 21:15:29 CDT