I have a pair of columns that were unfortunately defined incorrectly as TIMESTAMP(6)
instead of TIMESTAMP(6) WITH TIME ZONE
. I would like to migrate those columns from the old, wrong datatype to the new, correct one. On top of that, the values appear to have been captured in E(S|D)T and I need the value in UTC.
So far, the best I've got is:
alter table OOPSIE_TABLE add (
NEW_COLUMN_A timestamp(6) with time zone,
NEW_COLUMN_B timestamp(6) with time zone
);
update OOPSIE_TABLE set
NEW_COLUMN_A = COLUMN_A,
NEW_COLUMN_B = COLUMN_B
;
alter table OOPSIE_TABLE drop column (
COLUMN_A,
COLUMN_B
);
alter table OOPSIE_TABLE rename column NEW_COLUMN_A to COLUMN_A;
alter table OOPSIE_TABLE rename column NEW_COLUMN_B to COLUMN_B;
Unfortunately, that leaves me with data that looks like 15-JUN-12 05.46.29.600102000 PM -04:00
, when I want 15-JUN-12 09.46.29.600102000 PM UTC
(or however Oracle would format it).
I've done select dbtimezone from dual;
and it shows me +00:00
, so I'm not sure how to proceed. Ideally, I would be able to do this in pure DML, and have it account for DST based on the old date values (which I'm sure are in the America/New_York timezone).