Solved

combining a date field with a time field 2 different formats - Oracle

Posted on 2013-11-20
2
958 Views
Last Modified: 2013-11-26
Good Afternoon Experts,
 I need some assistance on how to combine to fields together.

I have a field that is called surgery_start_date which a date field that shows as such:

8/25/2013 12:00:00 am

the other field called surgery_start_time is a vchar(5) fields with show the following
08:45

what I need is for to show up as

08/25/2013 08:45

how can this be achieved?  thanks in advance.
0
Comment
Question by:Butterfly2
2 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39664075
select to_char(surgery_start_date,'MM/DD/YYYY') || ' ' || surgery_start_time from table;
0
 
LVL 34

Accepted Solution

by:
johnsone earned 500 total points
ID: 39664096
That would work for display purposes.  If you wanted to do any kind of date math with it, you would need to turn the combined fields into a date like this:

to_date(to_char(surgery_start_date,'mmddyyyy')||surgery_start_time, 'mmddyyyyhh24:mi')
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

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

746 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

9 Experts available now in Live!

Get 1:1 Help Now