My table table1 has the column date_txt which includes 2/16/2011 12:00:00 AM - column date_txt is VARCHAR2 (250 Char).
My table table1 also has the column date which is a DATE.
I would like to "update" my field:
The final output should be:
table1:
date
2/16/2011
So it takes from table1 date_txt the "date" and updates it to the column date as a date.
Any ideas? I am a bloody beginner.
You can use Oracle's to_date function to convert a string to a date:
update table1 set "date" = to_date(date_txt, 'MM/DD/YYYY HH:MI:ss AM')
See it working at SQL Fiddle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With