database - Oracle change Date to time stamp -


my table has date type column need see gmt information idea change timestamp column. how change column has value filled?

create table pro_tfestivo ( oid_festivo number(10) not null, fecha_hora_envio date timestamp ); 

thank all!!

you cannot change date/timestamp type without:

  1. create temporary column existing values;
  2. create new table original name;
  3. fill existing values "new" column.

convert date timestamp time zone:

alter table pro_tfestivo rename column fecha_hora_envio old_fecha_hora_envio; alter table pro_tfestivo add fecha_hora_envio timestamp time zone; update pro_tfestivo set fecha_hora_envio = from_tz(cast(old_fecha_hora_envio timestamp), 'gmt'); alter table pro_tfestivo drop column old_fecha_hora_envio; 

plus :) convert timestamp time zone date:

alter table pro_tfestivo rename column fecha_hora_envio old_fecha_hora_envio; alter table pro_tfestivo add fecha_hora_envio date; update pro_tfestivo set fecha_hora_envio = cast(to_timestamp_tz(old_fecha_hora_envio, 'dd/mm/yyyy hh24:mi:ssxff tzr') @ time zone 'gmt' date); alter table pro_tfestivo drop column old_fecha_hora_envio; 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -