Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Adding One Month to a Date

Re: PL/SQL Adding One Month to a Date

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1997/10/08
Message-ID: <343d9b90.4710503@newshost>#1/1

On Wed, 08 Oct 1997 13:27:31 +0200, "René Schutte" <Rene_at_webhost.co.za> wrote:

>Hi there,
>
>I sincerely hope anyone can help me with this simple query.
>
>If I have declared:
> t_date date;
>and I do the following:
> t_date := t_date + 1;
>I get the date increased by ONE DAY (the default, as I understand it)
>
>I would like to add ONE MONTH to the value of t_date, and as I
>understand it, there is a function that allows you to do this. I don't
>know what the function's name is, and I don't know the syntax for it.
>
>Can anyone help????

SQL> declare
  2 t date default sysdate;
  3 begin
  4 t := add_months( t, 1 );
  5 dbms_output.put_line( t );
  6 end;
  7 /
08-NOV-97   PL/SQL procedure successfully completed.  

SQL> Do you have the sql language reference manual? all the functions are in there (sql functions may be used in pl/sql as well with the exception of DECODE which you must 'select' in order to use in pl/sql)

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD

http://govt.us.oracle.com/ -- downloadable utilities



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Wed Oct 08 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US