Calculate actual time (Out Date Time - In Date Time)

Hi All
I am using Oracle 9i
I have a two column table
having date and time value in on of the column
data is look like this
Name Performed_Time
IN 30-MAR-2008 09:15
OUT 30-MAR-2008 11:30
IN 30-MAR-2008 12:00
OUT 30-MAR-2008 14:45
IN 30-MAR-2008 16:00
OUT 30-MAR-2008 18:21
No the problem is that
I need to calculate the actual time between every OUT and IN e.g OUT - IN (Out Time minus In Time)
wud anybody plz help me regarding this?
Thanks
Hassan

Nice one, but seems to be expensive.
SQL> set autotrace on
SQL> Select (dt_out - dt_in) * 24*60
  2        from (select flag, dt dt_in, lead(dt) over (order by dt) dt_out
  3                from t)
  4      where flag = 'IN';
(DT_OUT-DT_IN)*24*60
                 135
                 165
                 141
Execution Plan
Plan hash value: 3295878825
| Id  | Operation           | Name | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT    |      |     6 |   126 |     4  (25)| 00:00:01 |
|*  1 |  VIEW               |      |     6 |   126 |     4  (25)| 00:00:01 |
|   2 |   WINDOW SORT       |      |     6 |    72 |     4  (25)| 00:00:01 |
|   3 |    TABLE ACCESS FULL| T    |     6 |    72 |     3   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   1 - filter("FLAG"='IN')
Note
   - dynamic sampling used for this statement
Statistics
          4  recursive calls
          0  db block gets
         15  consistent gets
          0  physical reads
          0  redo size
        473  bytes sent via SQL*Net to client
        395  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
          3  rows processed
SQL>
SQL>
SQL>   Select ins.dt as in_time, outs.dt as out_time, (outs.dt - ins.dt)*24 as time_in
  2      from (
  3           select flag, dt, row_number() over (order by dt) as rn
  4           from t
  5           where flag = 'IN'
  6          ) ins
  7          LEFT OUTER JOIN
  8          (select flag, dt, row_number() over (order by dt) as rn
  9           from t
10           where flag = 'OUT'
11          ) outs
12          ON (ins.rn = outs.rn);
IN_TIME           OUT_TIME             TIME_IN
30-MAR-2008 09:15 30-MAR-2008 11:30       2.25
30-MAR-2008 12:00 30-MAR-2008 14:45       2.75
30-MAR-2008 16:00 30-MAR-2008 18:21       2.35
Execution Plan
Plan hash value: 3072654067
| Id  | Operation            | Name | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT     |      |     3 |   138 |     9  (34)| 00:00:01 |
|*  1 |  HASH JOIN OUTER     |      |     3 |   138 |     9  (34)| 00:00:01 |
|   2 |   VIEW               |      |     3 |    72 |     4  (25)| 00:00:01 |
|   3 |    WINDOW SORT       |      |     3 |    45 |     4  (25)| 00:00:01 |
|*  4 |     TABLE ACCESS FULL| T    |     3 |    45 |     3   (0)| 00:00:01 |
|   5 |   VIEW               |      |     3 |    66 |     4  (25)| 00:00:01 |
|   6 |    WINDOW SORT       |      |     3 |    36 |     4  (25)| 00:00:01 |
|*  7 |     TABLE ACCESS FULL| T    |     3 |    36 |     3   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   1 - access("INS"."RN"="OUTS"."RN"(+))
   4 - filter("FLAG"='IN')
   7 - filter("FLAG"='OUT')
Note
   - dynamic sampling used for this statement
Statistics
          7  recursive calls
          0  db block gets
         30  consistent gets
          0  physical reads
          0  redo size
        623  bytes sent via SQL*Net to client
        395  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          2  sorts (memory)
          0  sorts (disk)
          3  rows processed
SQL>

Similar Messages

  • Disk Utility - Format Time for 500GB (Zero Out Data)

    Hello.
    Is there one length of time for formatting a hard drive with one pass of Zero Out Data? For instance, does the length of time change depending if you format with zeros using USB2, FW400, FW800, or eSATA?
    *My Format Setup*
    LaCie Rugged 500GB All-Terrain (USB2 & FW400/800)
    FW800 Cable
    GUID Partition Table
    Mac OS Extended (Journaled)
    Zero Out Data (One Pass)
    I'm formatting with a FW800 connection. Disk Utility has said it will take 1.5 hours for about 3.5 hours now. The blue bar has progressed even though the time remaining is incorrect. At this rate, it will take seven hours to format 500GB.
    I'm going to be formatting multiple 500GB and 1TB drives, and I'm wondering if the time I'm experiencing is normal. Therefore, it should take a day to format 1TB with one pass of zeros. Is this correct?
    Thank you for your help! =)
    Message was edited by: Revearti

    It takes a long time to zero out data on a 500GB drive. The larger the drive, the longer it takes. I don't think the connection makes a difference, since each of your listed options are high speed. Never tried it on an external with USB 1.1, so can't give you any real time experience there. But it will take well over an hour to write zeros on every block of a 500GB drive.

  • Workspace v1.8 - File Share shows actual time instead of expiration date

    Hi,
    our customer still uses Workspace Files Version 1.8 an in the main everything works fine. There is just one problem:
    When he creates a share for a file (not a folder) the expiration date for it should be shown - but in fact the actual time (when the share is created) is shown.
    Anyone seen this before? Is there a patch or any other possibility to resolve this?
    Thanks in advance!
    Marco

    I was having this exact same problem, then it just stopped. I am using the nouveau driver and I have a tnt2 card.
    IIRC, I was having an unrelated problem with xorg or udev or something was having problems detecting my monitor, it claimed I had two monitors connected, I wrote an xorg.conf file and that fixed the problem. IDK if its is related or not because I don't recall exactly when things started working when I would switch ttys.
    Try using the nouveau driver and see if it does the same thing, it has a kernel module so it might make difference,
    Last edited by RiceKills (2010-07-06 23:39:27)

  • How to calculate Average time from a date field

    Hi All,
    I have a date type field in my table .
    I want to calculate average time for a given country in a select query. Date has to be exculded. Only time has to be taken into consideration.
    Kindly help me.
    Sample data
    india 25-JUN-09 08:12:45
    india 25-JUN-09 09:01:12

    Take which one you want.WITH dates AS
      (SELECT sysdate x FROM dual
        UNION
       SELECT sysdate + 1 +1/24 FROM dual
    SELECT TO_CHAR(to_date(AVG(to_number(TO_CHAR(to_date(TO_CHAR(x,'HH24:MI:SS'),'HH24:MI:SS'),'sssss'))),'sssss'),'hh24:mi:ss')
       FROM dates;
    WITH dates AS
      (SELECT sysdate x FROM dual
        UNION
       SELECT sysdate + 1 +1/24 FROM dual
    SELECT floor(24 * AVG(x- TRUNC(x)))
      || ':'
      || floor(mod(24 * AVG(x- TRUNC(x)),1) * 60)
      || ':'
      || floor(mod(mod(24 * AVG(x- TRUNC(x)),1) * 60,1) * 60)
       FROM dates;By
    Vamsi

  • How to retrieve users logging-in and logging-out date and times in SharePoint

    At the moment I am using SherePoint 2013 with a few tenants.
    I am going to have access to the users logging-in and logging-out dates and times.
    For instance, I would like to know the detail of the dates and times which a particular user of a tenant has logged-in and logged-out during the past few months.
    Any idea?

    You can retrieve that info from the IIS log files. Maybe you can use a free IIS reporting tool that I've built and adjust it to your own needs, you can get it here:
    http://gallery.technet.microsoft.com/office/The-SharePoint-Flavored-5b03f323
    Btw, in a web environment usually there is no such thing as the log-out date and time because the end user just stops making requests. So, you've got to take a look at the last request and by default, after 20 minutes the session times out and you can assume
    the session has ended.
    Kind regards,
    Margriet Bruggeman
    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com

  • How to calculate the Time difference between 2 dates

    HI All,
    I am using HR_hk_diff_btw_2_dates to calculate the employee service dates.
    For that i  am inputing his hire date and Term dates and Output format as '05' i am getting output perfectly....
    But problem is  whe i am inputting the employee hire date is Dec 1 2007 and Term date is
    March 31 2009 It is coming as 1 year 3 months  31 days instead of 1 year 4 months directly .......How could we make it make last date also working day and get the O/p as 1 year 4 months ?Please Advice..
    Regard
    sas

    1. FM for difference betwwen two times:SCOV_TIME_DIFF
    Import parameters               Value
    IM_DATE1                        2008-01-01
    IM_DATE2                        2008-01-01
    IM_TIME1                        10:00:00
    IM_TIME2                        11:30:00
    Export parameters               Value
    EX_DAYS                         0
    EX_TIME                         01:30:00
    2. SD_CALC_DURATION_FROM_DATETIME : Finds the difference between two date/time and report the difference in hours
    L_MC_TIME_DIFFERENCE : Finds the time difference between two date/time

  • Time Machine missing backups, grayed out dates

    My Time Machine disk is showing blacked out dates for some of my folders and no backups of those folders and files for those dates...There are earlier and later backups for some of the folders, but missing interim dates even though other folders were backed up. This seems to have happened after the Lion upgrade. Note: It's not a disc capacity issue, as my backup disk is 2 tb.....

    Welcome to Apple Support Communities
    To access to older backups through Time Machine, read > http://pondini.org/TM/B6.html When you get a new hard drive and install OS X in it, Time Machine creates a new backup instead of connecting it to the old backups you had, so you cannot access to those backups.

  • Calculate difference between two dates/times

    Hi all,
    Is there any function module to calculate difference between two dates/times which are in TIMESTAMPL format.
    I need to know how many millisconde(second,minutes, hours... )there is between these two times.
    Please, It is urgent
    Thank you all.
    Karim

    hi,
    try the following function
    CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'        
          EXPORTING                                  
               timestamp1 = timestamp1               
               timestamp2 = timestamp2               
          IMPORTING                                  
               difference = diff                     
          EXCEPTIONS                                 
               OTHERS     = 1. 
    the above function gives the difference in seconds...
    try the following  code to set the resolution to milliseconds..
    SET RUN TIME CLOCK RESOLUTION LOW
    check the thread for details:
    SET RUN TIME CLOCK RESOLUTION?
    all the best!!!
    Regards,
    Aparna

  • When I send an email notification that the form has been sent I want the receiver to get a copy of the actual filled out form not a ling to the data, how can I make this happen?

    When I send an email notification that the form has been sent I want the receiver to get a copy of the actual filled out form not a ling to the data, how can I make this happen?

    Hi,
    you can find documentation for Designer under this website
    http://help.adobe.com/en_US/livecycle/10.0/documentation.html#task=4,5&module=2
    In Designer you can use the JavaScript API of Acrobat.
    So the Devnet for Acrobat is also a good source.
    http://www.adobe.com/devnet/acrobat.html
    http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/js_api_reference.pdf

  • How to Find Actual Time Spent on a TASK in TFS 2013 by using the scrum template

    Hi! Currently we are using the TFS 2013 version with Scrum template this template contains only Remaining work measure for Task item and there is no
    other option for getting the Actual time spent on particular Task and Bug having the option called Effort. How to find the Actual Time spent or Actual effort hours on particular TASK is it possible? In the similar way the Agile Template having the These options
    like
    1 Original Estimate
    2 Completed Work
    3 Remaining Work 
    Can i use these 3 for Scrum Templete also?
    We require the feature similarly like Atlasian JIRA product (JIRA consist the Actual time, Estimation Time and Log).

    The Scrum template doesn't have these fields, tracking "spent time" is not really in line the philosophy of Scrum. it's tracking data that is not really useful anyway, unless you have to do some form of reporting. In which case you probably already
    have a system to track time in at a higher level. 
    The way TFS tracks time is very hard to use when you have a highly collaborative team, it would require you to create tasks for each person contributing to a task or constant re-asssigning of tasks to track the correct time spent. How else would you track
    two peopleworking together? Pair programming, for example is a practice we at scrum.org highly promote. As well as pairing a tester and a developer up on applying ATDD when working on a story together. When a story is taking "too long" to move off
    the board a technique called swarming is often applied, in which all team members help out to move the story along at a higher pace or to get it unstuck. These ways of workign are very, very, very hard to capture in TFS. But we think the threshold to use these
    techniques should be very low. People should default to these ways of working and not be punished by bad functioning tooling.
    As mentioned by Alexandr, you can extend the Scrum template with the same fields the MSF templates use, but I would not recommend it. Instead, if you need to track time, first consider doing it in different tool and at a different level than task. Maybe
    feature, activity or product backlog item.
    If you still want to track time, then a tool like
    Imaginet Time Sheet can extend TFS in ways that make it a lot easier to track time against any work item.
    As a last resort, consider
    adding the fields from the MSF template, but I beg you to reconsider.
    My blog: blog.jessehouwing.nl

  • Disk Utility Zero Out Data option

    I read that it can be good to write zeros to all sectors of a new external disk right away. The Zero Out Data option in the Disk Utility Erase operation states that it "writes zeros over all data on the disk". Does it actually write zeros over every sector on the disk or just sectors with data? The 7 Pass Erase option states that it "writes data over the entire disk seven times". I'm guessing this means all sectors get zeroed out whether they contain data or not. The different wording suggests that these operations do different things. Any one have clarification? Thank you.

    For those who may have to reformat a new hard disk drive, one may as
    well take a little more time and have another cup or three of coffee...
    and let the computer utility write zeros in one pass; maybe even twice.
    Some new computers, especially some sold in a few geek guy stores,
    had their bogus utilities installed; an additional $40. charged on each.
    If you liked it or not. Same computer elsewhere, -40 but no geek app.
    And their choice caused some people issues with their new non-PC.
    The best avenue was to boot from OS X install disc & choose secure
    erase, and totally over-write the new computer's corrupted software.
    And choose the install option after disk utility ran, and start over right.
    With the correct partition map, reformat and a new full install.
    New and planned replacement upgrade hard disk drives can be put
    into an external HDD enclosure ahead of schedule, if not a tower;
    and ready them for later use; even test them thoroughly if desired.
    Especially if the computer the HDD is intended for, is hard to open.
    The main consideration, other than product testing, or in feeling all
    warm and techie inside, is the amount of time this sort of thing takes.
    The impatient won't hold up under the strain of loftier commitments.
    Oh well... coffee is cheaper if you get yours from Kona directly.
    Good luck & happy computing!

  • Calculate from graph cursor data

    I need to calculate from cursor data in a grpah that has been read from a file and displayed. Specifically, I want to position locked-on-trace cursors and calculate the delta-time or delta-voltage from their positions like one would with a standard scope. Attached is a file of the trace to read, 2 channels, Cursors would be on either ch-1 or 2. Simple read VI attached.
    Attachments:
    Read_and_chart_data.vi ‏31 KB
    s250.txt ‏13 KB

    Here's a very simple example. You just have to use the graph's property node to get the cursor position. If you know the sample rate, you can fine tune it to display actual time.
    Attachments:
    Read_and_chart_data_mod.vi ‏44 KB

  • How to calculate the time between start trigger,first scan and first A/D in DAQ

    Environment: Labview 6.1, N6052E DAQ board(max scan rate=333KHz, max channel rate=333KHz, settling time=3.5usec+1LSB)
    I am using external scan clock 10K scan/s collecting data on 16 AI channels, and external channel clock 200KHz.
    Could show me how to calculate the time betweent he start trigger, the first scan and the first A/D conversion?
    Thanks

    I read the one you give to me. still cannot work out. I am using Labview 6.1 DAQ vi, including AI config.vi. clock config.vi, AI control.vi, AI read.vi, working on colect data on 16 AI channels. So I belong to SCAN function and external scan and sampling timing, right?
    But it says the T1 and T2 are determined by external signals. How can I calculate that?
    T1=1/10KHz or T1=1/160Khz?
    T2=1/200KHz?
    Is the above correct?

  • Calculate local time based on timezone offset

    I am sure this question has been answered many times. but if you can explain me how to calculate local time based on the timezone offset.
    for instance, I am in central time zone. but i want to display local pacific time on my page. I have the timezone offset as -420 minutes.
    Thanks in advance.
    KM

    given a database table tzdata composed of time zone names and tz offset
    i want to be able to display the corresponding Date / Time of each country
    based on the time zone offset .
    in the offsets i posted above i found things like +10.5 ,-1.2 ect..
    how to convert those into the correct format so i can feed it to SimpleTimeZone() construtor ?Why would you want to?
    I am just pointing out here that java already has all those timezones and offsets configured into it. As well as if/when DST applies.
    String[] zones = TimeZone.getAvailableIDs();
            for (int i=0; i<zones.length; i++){
              System.out.println("Zone " + i + " = " + zones[i] + " offset = " + TimeZone.getTimeZone(zones).getRawOffset());
    In other words this database table is reinventing the wheel.
    You just need to tell Java which Timezone you want (according to the standard names for timezones begin Region/City) and it will work out the correct offset.
    eg
    for Afghanistan: new TimeZone("Asia/Kabul");
    Albania: new TimeZone("Europe/Tirane");
    Cheers,
    evnafets

  • Get actual time for specific time zone

    Dear experts,
    is it possible to get the actual time for a given time zone? We need to know the time of a certain plant and we are searching for a standard function module which calculates the time based on the plants time zone.
    Thanks in advance,
    David
    Edited by: David Claes on Apr 12, 2010 5:05 PM

    You can use TIME ZONE statement for this.
    DATA: time_stamp_s TYPE string,
                time_stamp     TYPE timestamp,
                tzone              TYPE timezone,
               wf_date_conv TYPE sy-datum,
               wf_time_conv TYPE sy-uzeit.
    tzone = 'CET'.
    CONCATENATE sy-datlo   "Local Date
                              sy-timlo    "Local Time
                      INTO time_stamp_s.
    time_stamp = time_stamp_s.
    CONVERT TIME STAMP time_stamp TIME ZONE tzone INTO DATE wf_date_conv TIME wf_time_conv.
    Otherwise FM IB_CONVERT_INTO_TIMESTAMP/IB_CONVERT_FROM_TIMESTAMP can bne used for same.
    Edited by: Satyajit on Apr 13, 2010 1:31 PM

Maybe you are looking for

  • All of a sudden I cannot bookmark websites.

    I am running Firefox 3.6.12, with add-ons of Firefox Sync, X-Marks and Speed Dial (among others but I have a feeling it has something to do with one of these). Computer is running Windows 7, 64. The last couple of days - mostly today - I have been un

  • Oracle text contains and mixed queries

    Trying to optimize the following sql statement using oracle text.  When postal code is given, I would like to limit the contains to only filter the smaller subset.  Both of these queries produce the same results in the same amount of time with practi

  • Creation of search help

    hi, i need to create a search help to get vendor with a given partner function. This allows the user to enter organizational information such as purchasing organization and plant, as well as the partner function and a reference to other vendor (the v

  • Apple TV- WLC 2504

    I have not been able to get Apple TV to work with a wlan on a 2504 WLC.  Below is my configuration.  Both the Apple TV and the i-devices are on the same subnet.  They connect to different SSID's/WLAN, but both WLANS map to the same segment.  On the i

  • Combine Feature

    My Combine Files feature has disappeared from Tools.  Why and where?