Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to Safely Perform Data Type Conversion in an Oracle Table

Posted on 2011-03-17
1
Medium Priority
?
262 Views
Last Modified: 2012-05-11
Dear experts,

We are using Oracle 11 Database and we have more than a dozen of "very large" tables. All the tables have a field (column) with Time Stamp (3) type. How can we convert these fields to DATE type  in a safe way without recreating table?

Note: The truncation of the Time Stamp field (seconds fraction etc.) is not important. Year, Month, Date, Hour, Minutes are enough.

BR,

0
Comment
Question by:GurcanK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
qasim_md earned 1000 total points
ID: 35155706
1) you have to update your table with the UPDATE statement to eliminate the seconds fractions:
UPDATE TABLE1
SET date_column = convert(datetime,date_column)

2) After the table data is updated and the seconds fraction is removed ALTER the table column to the Datatype you want.

did that help ? let me know...
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question