Solved

How to Safely Perform Data Type Conversion in an Oracle Table

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now