Home » SQL & PL/SQL » SQL & PL/SQL » update diff datatype
update diff datatype [message #215839] Wed, 24 January 2007 01:17 Go to next message
oracle_coorgi
Messages: 185
Registered: September 2006
Location: INDIA-karnataka
Senior Member
hi
want to update data from column update_on data type varchar2(1200) to column temp_update datatype timestamp in the same table

eg:
update policy_doc set temp_updated_on=updated_on;
Re: update diff datatype [message #215841 is a reply to message #215839] Wed, 24 January 2007 01:22 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You'll have to use a function which will transform string into a timestamp.
Re: update diff datatype [message #215845 is a reply to message #215841] Wed, 24 January 2007 01:27 Go to previous messageGo to next message
oracle_coorgi
Messages: 185
Registered: September 2006
Location: INDIA-karnataka
Senior Member
update tablename
set temp_updated =TO_TIMESTAMP ('updated_on', 'YYYY-MM-DD HH:MI:SS');
Re: update diff datatype [message #215860 is a reply to message #215845] Wed, 24 January 2007 02:03 Go to previous message
oracle_coorgi
Messages: 185
Registered: September 2006
Location: INDIA-karnataka
Senior Member
i can update like this if same datatype
update policy_doc set temp_updated_on=updated_on;
if its differnent datatype how to go about

eg:
update policy_doc
set temp_updated =TO_TIMESTAMP ('updated_on', 'YYYY-MM-DD HH:MI:SS');
Previous Topic: min marks from subjects
Next Topic: SQL queries for practice
Goto Forum:
  


Current Time: Sun Dec 04 10:58:27 CST 2016

Total time taken to generate the page: 0.10966 seconds