Oracle: set timezone for column
Posted
by dbf
on Stack Overflow
See other posts from Stack Overflow
or by dbf
Published on 2010-03-23T09:28:41Z
Indexed on
2010/03/23
10:43 UTC
Read the original article
Hit count: 420
Hi, I need to do migration date->timestamp with timezone similar to described here: http://stackoverflow.com/questions/1664627/migrating-oracle-date-columns-to-timestamp-with-timezone. But I need to make additional convertion (needed to work correctly with legacy apps): for all dates we need to change timezone to UTC and set time to 12:00 PM. So now dates are stored in local database (New York) timezone. I need to convert them this way
25/12/2009 09:12 AM (local timezone) in date column => 25/12/2009 12:00 PM UTC timestamp with local timezone column.
Could you advice, how to set timezone for date value in Oracle (I found only suggestions how to convert from one timezone to another) (for example in Java there is setTimeZone method for Calendar objects).
We want to make a convertion this way:
- rename old date column to NAME_BAK
- create new column timestamp with local timezone
- iterate over old column for not-null values set timezone to UTC, time to 12:00 PM
- drop old column after testing of this migration
© Stack Overflow or respective owner