Will
Will

Reputation: 317

Update a timestamp column

I need to all of timestamps in a column the same amount. I want to write an sql statement like:

update sometable set timecol = timecol + <4 months>;

Upvotes: 2

Views: 2020

Answers (2)

Paul Tomblin
Paul Tomblin

Reputation: 182772

update sometable set timecol = timecol + interval '4' month;

Strangely enough, I can't find this in the Oracle documentation anywhere, but it works on my Oracle XE installation. It's fairly close to the way PostgreSQL does it, and I believe it's part of one of the SQL standards.

Upvotes: 1

Tony Andrews
Tony Andrews

Reputation: 132570

update sometable set timecol = add_months(timecol,4);

See documentation

Upvotes: 1

Related Questions