Home » SQL & PL/SQL » SQL & PL/SQL » Total Time. (sql query)
Total Time. [message #608013] Fri, 14 February 2014 03:54 Go to next message
Messages: 10
Registered: January 2014
Location: India
Junior Member
In_date | In_time | out_date out_time |Total Time
mm/dd/yyyy |HH:MM:SS | mm/dd/yyyy | HH:MM:SS |
2/6/2010 |7:30:00 am | 3/9/2010 |11:59:00 am | ?

In_date display and also display in time,out_date display and also display out time ,to calculate the total time as date base or time base.
I want to calculate the total time.

[Updated on: Fri, 14 February 2014 04:02]

Report message to a moderator

Re: Total Time. [message #608014 is a reply to message #608013] Fri, 14 February 2014 04:00 Go to previous messageGo to next message
Messages: 536
Registered: March 2009
Location: Iran / France
Senior Member
And what you mean by total time? number of months? weeks? days? hours? ...
Also I don't understand your design a DATE can also store time portion so what's the point of storing time in separate columns? (I mean in_time and out_time)
Re: Total Time. [message #608015 is a reply to message #608013] Fri, 14 February 2014 04:02 Go to previous message
Messages: 21042
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
When subtracting two DATE values, the result is number of DAYS. A little bit of arithmetic converts it into days, hours, minutes ... whatever you want.

What are IN and OUT columns' data types? If these are characters, concatenate them and apply correct DATE format mask to convert it to dates; then subtract them.
Previous Topic: PLS-00204: function or pseudo-column 'EXISTS' may be used inside a SQL statement
Next Topic: all_objects behaving differently when called from a pl/sql function (merged 3)
Goto Forum:

Current Time: Wed Mar 29 06:23:32 CDT 2017

Total time taken to generate the page: 0.12072 seconds