There is a minor issue with this approach though. It broke a test case.
Look at the last row, since 2000 is a leap year, but 1900 is not a leap
year this might not work universally. Barbara does not want to change
the date, just the year. Agreed, it will work for Barbara 's test case if
the rows are only have a value of 2099.
select crdate, add_months(crdate, -1200) from mytabdate
-- --Original Message-- --
From: oracle-l-bounce@(protected)
[mailto:oracle-l-bounce@(protected)] On Behalf Of Khedr, Waleed
Sent: Tuesday, March 23, 2004 3:12 PM
To: oracle-l@(protected)
Subject: RE: update year in date column
It 's 100 years equals 1200 months.
Use add_month( <column >, -1200)
Waleed
-- --Original Message-- --
From: Barbara Baker [mailto:barbarabbaker@(protected)]
Sent: Tuesday, March 23, 2004 3:01 PM
To: oracle-l@(protected)
Subject: update year in date column
OK, I 'm just going to bite the bullet and claim total
ignorance here and see if someone takes pity on me :(
(sad face a nice touch, eh?)
Someone has accidently updated 378 records in the
customer table. The date changed from 1999 to 2099.
I need to change just the year back to 1999 for these
records. (I 'd like to keep the time stamp, if
possible. The month and day are correct.) I looked
on metalink, google, and asktom. Some nice examples,
but not what I really need.
Thought I 'd be clever and subtract 1000 from the date.
This works, but I don 't know how to get it formatted
back into a date.
I 'd prefer just sqlplus, but will use pl/sql if
necessary.
Here 's what I 've done so far:
(solaris 9 oracle 9.2.0.4)
__ ____ ____ ____ ____ ____ ______
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe send email to: oracle-l-request@(protected) put
'unsubscribe ' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe send email to: oracle-l-request@(protected) put
'unsubscribe ' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. If the reader of this message is not the intended recipient,
you are hereby notified that your access is unauthorized, and any review,
dissemination, distribution or copying of this message including any
attachments is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete the material from any
computer.