?
Solved

Update a column

Posted on 2013-06-11
3
Medium Priority
?
361 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
[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
  • 2
3 Comments
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
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 38

Accepted Solution

by:
Gerwin Jansen, EE MVE earned 2000 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
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 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.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
Suggested Courses

800 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