Re: Question: Update Year for a Date Field

From: Harri Kaukovuo <hkaukovu_at_gatekeeper.us.oracle.com>
Date: 1996/01/04
Message-ID: <4chbic$21f_at_inet-nntp-gw-1.us.oracle.com>#1/1


What about usingIn article <30EBF85A.2B3F_at_us.oracle.com>, "Robert C. Nix" <rnix_at_us.oracle.com> writes:
|>Mai wrote:
|>>
|>> Does anyone know the SQL statements/functions to update Year for a DATE field in a table on Oracle???? i,e, update the value of a field from dd-MMM-95 to dd-MM
|>> Without changing the values of Month and Day...
|>>
|>> If you have an answer Please post or email me at mai_at_mcs.com.
|>>
|>> Thanks a lot!!
|>
|>update <table>
|> set THEDATE = THEDATE - to_number(to_char(to_date('31-dec-94'),'DDD'))
|> where to_char(THEDATE,'YYYY') = '1995';
|>

It would maybe be easier just to use ADD_MONTHS -function:

SQL> select
  2 sysdate
  3 , ADD_MONTHS(sysdate,12)
  4 from dual;  

SYSDATE ADD_MONTH
--------- ---------
04-JAN-96 04-JAN-97 With best regards,

        Harri



Oracle Corporation
Harri Kaukovuo,  Applications Engineer		Tel.	+1-415-506 3258
500 Oracle Parkway, P.O.Box 659304		Fax	+1-415-506 7292
REDWOOD SHORES, CA 94065, USA			hkaukovu_at_us.oracle.com
Received on Thu Jan 04 1996 - 00:00:00 CET

Original text of this message