Re: Question: Update Year for a Date Field
Date: 1996/01/04
Message-ID: <DKoKBy.5xn_at_li-business.ab.ca>#1/1
>
>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-MMM-94???
>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!!
>
>
You will want to do something like this...
update table_name
set column_name = add_months(column_name, -12) where column_name = '15-JAN-95';
- table_name *** is the name of the table to be updated.
- column_name *** is the name of the column in the table to be updated.
This will effectivly change ALL records that match your "where" clause. i.e. ALL records that have a date of '15-JAN-95'. You may need to be more specific in your where clause if you want to narrow your update to specific or single record(s)... (if more that one record has the same date)
I hope this helps you out... Dan
--- Dan Petesky Legal Integrations Inc. Edmonton, Alberta Canada dan_at_li-business.ab.ca This posting is mine alone and does not reflect the opionion(s) of my employer.Received on Thu Jan 04 1996 - 00:00:00 CET