Solved

Update a column

Posted on 2013-06-11
3
356 Views
Last Modified: 2013-06-11
Hi,
I have a column with DATE datatype and has data in it.
Based on this column, I would like to update another column that is of NUMBER datatype.
The data should be updated as follows:

source_column: 01-JAN-2013
target_column: 20130101 (YYYYMMDD format)

Could someone please suggest?

Thanks
0
Comment
Question by:MRPT
  • 2
3 Comments
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 39238157
Try this:

select to_number(to_char(trunc(source_column),'YYYYMMDD'))
from your_table;

(to see if you get the right values).
0
 
LVL 37

Accepted Solution

by:
Gerwin Jansen earned 500 total points
ID: 39238162
And if it looks OK, update like this:

update your_table
set target_column = to_number(to_char(trunc(source_column),'YYYYMMDD'));
0
 

Author Closing Comment

by:MRPT
ID: 39238202
Works as wanted, thank you.
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.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
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 videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

910 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