Update date [message #307713] |
Wed, 19 March 2008 11:47  |
lowcash75
Messages: 67 Registered: February 2006
|
Member |
|
|
I have a date column in a table, in which somehow the application has inserted incorrect year. For example, instead of 2006, it contains 0006, 0007, 0008, etc... I need to run an update on that column to update just the year.
INSERT INTO test
("MY_DATE")
VALUES
(to_date('3/19/0007 01:13:23','MM/DD/RRRR HH24:MI:SS'))
/
INSERT INTO test
("MY_DATE")
VALUES
(to_date('3/19/0008 01:13:23','MM/DD/RRRR HH24:MI:SS'))
/
Any suggestions?
Thanks for your assistance
|
|
|
Re: Update date [message #307714 is a reply to message #307713] |
Wed, 19 March 2008 11:54   |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
For this case, you could just add 24,000 months:
UPDATE test SET my_date = Add_Months(my_date,24000);
|
|
|
|
Re: Update date [message #307722 is a reply to message #307713] |
Wed, 19 March 2008 12:15  |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
You probably want to find the problem because I can guarantee it is going to happen again.
Looks like a poor application design that expects 4 digit years and someone used a 2 digit year.
|
|
|