Solved

How to Safely Perform Data Type Conversion in an Oracle Table

Posted on 2011-03-17
1
258 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 250 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

726 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