To_Char Time Calculations

Hi
My DB version
===============
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production.
Issue
================
i have a table in which a column of current time stamp data. im trying to take the time part out of the time stamp fileld using to_char function.
But the out put differs.
select a.object_name,a.refresh_start,to_char(a.refresh_start,'HH:MM:SS:FF') Time_Begin 
from OUKC_Refresh_runtime aOutput of the above SQL
================
object_name refresh_start Time_Begin
ILA_PERFORMANCE_MV     11-MAY-10 02.03.07.100278000 PM     02:05:07:100278
OLN_USER_OFFERING_ENROLL_MV 11-MAY-10 04.27.13.936347000 PM     04:05:13:936347
OLN_REPORT1_MV     11-MAY-10 04.32.17.378745000 PM     04:05:17:378745
ILA_CATEGORY_MV     14-MAY-10 02.02.56.423235000 PM     02:05:56:423235
ILA_CLASSROOM_CATEGORY_MV     14-MAY-10 02.02.56.908533000 PM     02:05:56:908533
ILA_PERFORMANCE_MV     14-MAY-10 02.03.03.601787000 PM     02:05:03:601787
Please note the time of refresh_start and the converted filed it differs ????
thanks
Regards
Raj

The MM is for month, use MI for minutes!

Similar Messages

  • Execution time calculation issue

    Hi,
    I have a proceudre which update the tables data and it will capture the execution time for each and every table.
    For that i am using below procedure and its giving incorrect values. i.e., its giving end_time<start_time
    PFB code(Line nos 25,26,33,73,7679,80 code for exeution time calculation) and output.
    1 CREATE OR REPLACE PROCEDURE my_proc
    2 IS
    3 CURSOR c
    4 IS
    5 SELECT tablename, TYPE
    6 FROM table_list;
    7
    8 TYPE emp_record IS RECORD (
    9 empkey tab1.pkey%TYPE,
    10 rid ROWID,
    11 ID tab_join.ID%TYPE,
    12 dt tab_join.dt%TYPE
    13 );
    14
    15 TYPE emp_type IS TABLE OF emp_record
    16 INDEX BY BINARY_INTEGER;
    17
    18 v_emp emp_type;
    19
    20 TYPE emp_type_rowid IS TABLE OF ROWID
    21 INDEX BY BINARY_INTEGER;
    22 tab_no Number:=0;
    23 emp_rowid emp_type_rowid;
    24 r_cur sys_refcursor;
    25 v_start_time TIMESTAMP; /** Added for time calculation*/
    26 v_end_time TIMESTAMP; /** Added for time calculation*/
    27 string1 VARCHAR2 (1000) := 'SELECT b.empkey, b.ROWID rid, a.id id, a.dt dt FROM emp_base a,';
    28 string2 VARCHAR2 (1000) := ' b WHERE a.empkey = b.empkey';
    29 rowcnt Number;
    30BEGIN
    31 FOR c1 IN c
    32 LOOP
    33 tab_no:=tab_no+1;
    34 v_start_time := SYSTIMESTAMP; /** Added for time calculation*/
    35 BEGIN
    36 string_d := string1 || c1.tablename || string2;
    37
    38 OPEN r_cur FOR string_d;
    39
    40 LOOP
    41 FETCH r_cur
    42 BULK COLLECT INTO v_emp LIMIT 50000;
    43
    44 IF v_emp.COUNT > 0
    45 THEN
    46 FOR j IN v_emp.FIRST .. v_emp.LAST
    47 LOOP
    48 emp_rowid (j) := v_emp (j).rid;
    49 END LOOP;
    50
    51 upd_string := ' UPDATE ' || c1.tablename || ' SET id = ' || v_emp (1).ID || 'WHERE ROWID = :emp_rowid';
    52 FORALL i IN emp_rowid.FIRST .. emp_rowid.LAST
    53 EXECUTE IMMEDIATE upd_string
    54 USING emp_rowid (i);
    55 rowcnt := rowcnt + emp_rowid.COUNT;
    56 END IF;
    57
    58 EXIT WHEN v_emp.COUNT < 50000;
    59 v_emp.DELETE;
    60 emp_rowid.DELETE;
    61 END LOOP;
    62
    63 v_emp.DELETE;
    64 emp_rowid.DELETE;
    65
    66 CLOSE r_cur;
    67 EXCEPTION
    68 WHEN OTHERS
    69 THEN
    70 DBMS_OUTPUT.put_line (SQLERRM);
    71 END;
    72
    73 v_end_time := SYSTIMESTAMP; /** Added for time calculation*/
    74
    75 INSERT INTO exec_time
    76 VALUES (tab_no||' '||c1.tablename, v_start_time, v_end_time, v_end_time - v_start_time, rowcnt); /** Added for time calculation*/
    77
    78 COMMIT;
    79 v_start_time := NULL; /** Added for time calculation*/
    80 v_end_time := NULL; /** Added for time calculation*/
    81 rowcnt := 0;
    82 END LOOP;
    83END;
    Output :
    TableName: exec_time
    "TABLE_NAME"      "START_TIME"     "END_TIME"      "EXCUTION_TIME"      "NO_OF_RECORDS_PROCESSED"
    TAB7      5/29/2013 10:52:23.000000 AM      5/29/2013 10:52:24.000000 AM      +00 00:00:00.521707      773
    TAB5      5/29/2013 10:52:18.000000 AM      5/29/2013 10:52:15.000000 AM      -00 00:00:03.381468      56525
    TAB6      5/29/2013 10:52:15.000000 AM      5/29/2013 10:52:23.000000 AM      +00 00:00:08.624420      49078
    TAB2      5/29/2013 10:51:54.000000 AM      5/29/2013 10:51:42.000000 AM      -00 00:00:11.932558      529
    TAB4      5/29/2013 10:51:47.000000 AM      5/29/2013 10:52:18.000000 AM      +00 00:00:31.208966      308670
    TAB1      5/29/2013 10:51:45.000000 AM      5/29/2013 10:51:54.000000 AM      +00 00:00:09.124238      65921
    TAB3      5/29/2013 10:51:42.000000 AM      5/29/2013 10:51:47.000000 AM      +00 00:00:04.502432      12118
    Issue: I am getting execution time in negitive values because end_time<start_time coming.
    Please suggest me how to resolve this.
    Thanks.

    Welcome to the forum!!
    Please read {message:id=9360002} from the FAQ to know the list of details (WHAT and HOW) you need to specify when asking a question.
    I primarily hate 3 things in your code
    1. The way you have used BULK update which is totally unnecessary
    2. COMMIT inside LOOP
    3. The use of WHEN OTHERS exception.
    Your code can be simplified like this
    create or replace procedure my_proc
    is
       v_start_time timestamp;
       v_end_time   timestamp;
       v_rowcnt     integer;
    begin
       for c1 in (
                     select rownum tab_no
                          , tablename
                          , type
                       from table_list
       loop
          sql_string := q'[
                                  merge into #tablename# a
                                  using (
                                          select id, dt
                                            from emp_base
                                        ) b
                                     on (
                                          a.empkey = b.empkey
                                    when matched then
                                        update set a.id = b.id;
          sql_string := replace(sql_string, '#tablename#', c1.tablename);
          v_start_time := systimestamp;
          execute immediate sql_string;
          v_end_time   := systimestamp;
          v_rowcnt     := sql%rowcount;
          insert into exec_time
               values
                    c1.tab_no || ' ' || c1.tablename
                  , v_start_time
                  , v_end_time
                  , v_end_time - v_start_time
                  , v_rowcnt
       end loop;
       commit;
    end; In the INSERT statement on the table EXEC_TIME try to include the column list.
    NOTE: The above code is untested.

  • How is Processing time calculated in Simulation

    Hi,
    How is processing time calculated for every simulation-relevant object?
    say for example,
    i have 2 objects of person type (p1 and p1)
    4 human tasks (T1, T2, T3, T4)
    T1 assigned to p1, processing time 2hrs
    T2 assigned to p1, processing time 2hrs
    T3 assigned to p2, processing time 2hrs
    T4 assigned to p2, processing time 2hrs
    start --&gt; T1(p1) --&gt; T2(p1) --&gt; T3(p2) --&gt; T4(p2) --&gt; end
    Have not set any other simualtion parameters. now,
    * Duration for simulation is set to 6hrs,
    T1, T2, and T3 are getting processes once, but start event is getting processed twice
    # Why is start event getting processed second time?
    # Will this take any processing time..
    * Duration for simulation set to 7hrs,
    start event and T1 gets processed 2 times, T2 and T3 once..
    and the total processing time becomes *8hrs*..
    # At wht point of time does the second processing of T1 start.
    # If it is not after after the completion of one full process cycle, in this case, why not the second processing start at the end # of 2nd hour, or 4th hour.
    Thanks,
    Vishnupriya

    Hi Vishnupriya,
    "Why is start event getting processed second time?"Can you check the "Frequency" attribute of your start event? There you can specify how often the process will be triggered.
    "At wht point of time does the second processing of T1 start."You should be able to check it in the Processes (det.). It provides an overview regarding the process instances started during the simulation run. Furthermore you can check the Events (det.) category.
    Best regards,
    Danilo

  • Ess Leave  Request -Change in Time calculation without changing work schedu

    Hi All,
    We are implementing a ESS Leave Request in EP6 with backend HR ECC5.0.
    The time calculation is taken  from the Work schedule rule in
    HR backend which is 24*7.
    For example if the leave taken is for 2 days-systems calculates as 24*2=48 hrs
    but in actual the requirement is to calculate 2*8 =16 hrs without changing
    the Work Schedule in 2001 infotype in HR Backend.
    Can we do this change through
    1.Validation in portal itself
    2.Changing the RFC PT_ARQ_REQUEST_CHECK
    3.Changing the Absence Types
    Regards
    Anand.

    Hello,
    Please use:
    programming
    but without the spaces before and after } and {
    Testing:
    programming
    regards
    Rick Bakker
    Hanabi Technology

  • Scout: Too much time calculating dirty regions

    Hi All,
    Frist of all, sorry for my English.
    I have a problem with my AIR App, I'm developing for Android and iOS. In iOS works perfectly but on Android the performance is poor.
    I checked with Scout and this is what i see:
    I don't understand why it spends so much time calculating dirty regions but I didn't change anything on the DisplayList.
    Edit: AS you can see in the screen the frames are 13 but in the next frames is over 200 frames and that repeats.
    Can someone tell me how to interpret this results?
    Thanks a lot.
    Goratz
    Mensaje editado por: goratz

    The feature you are referring to exists in Logic but not in GarageBand (yet?). It is called the Marquee Tool that lets you drag a selection, and when hitting the delete key, that section of the Region(s) will be deleted, and the remaining part of the Region on the right will be moved to the left to close the gap (if you you have set the Drag Mode to "Shuffle L").
    Hope that helps
    Edgar Rothermich
    http://DingDingMusic.com/Manuals/
    'I may receive some form of compensation, financial or otherwise, from my recommendation or link.'

  • Warning Time calculation "Before Aggregation" is obsolete

    Hi,
    Recently in our project we have upgraded BW 3.0B to BI7.
    After upgrade to BI7,  when we run some of the reports we are getting a warning message as below -
    Warning Time calculation "Before Aggregation" is obsolete.
    Pls refer to the attachment.
    Any of our satyam colleagues encounter this warning, if so what was the solution you applied.
    Note : I found some notes in Forum like saying use ' Exception Aggregation' for the Before Aggregation.. etc etc., but my problem is in our project thre are many CKFs are there which are using 'Before Aggregation'.
    Please let me know if you have any other alternatives.
    Thanks !!!!!!!!!

    Hi,
    Try SAP notes 935903.
    Symptom
    Calculated Key Figures "Existance Indicator" with aggregation behaviour "Before Aggregation" will get now with NW 2004s warning popup "Time of calculation 'Before Aggregation' is obsolete" during execution.
    this may be helpful.
    thanks,
    JituK

  • Time Calculation Shell dimension is slow compared to hardcoded measure?

    Hi,
    I have a measuregroup with 200m+ rows with about 20 measures (sums). I've created a shell dimension to hold my time calculation members such as mtd, qtd, ytd, etc. My problem is that it performs REALLY poorly when using the time calculation dimension.
     My script looks like this:
    SCOPE
    Measuregroupmeasures("MyMeasureGroup");
    SCOPE
    [Time Calculation].[Calculation].&[None];
    THIS =
    [Measures].CurrentMember;
    END SCOPE;
    SCOPE
    [Time Calculation].[Calculation].&[MTD];
    THIS =
    Aggregate
    [Time Calculation].[Calculation].&[None]
    MTD([Date].[Calendar (YQMD)].CurrentMember)
    END SCOPE;
    SCOPE
    [Time Calculation].[Calculation].&[QTD];
    THIS =
    Aggregate
    [Time Calculation].[Calculation].&[None]
    QTD([Date].[Calendar (YQMD)].CurrentMember)
    END SCOPE;
    SCOPE
    [Time Calculation].[Calculation].&[YTD];
    THIS =
    Aggregate
    [Time Calculation].[Calculation].&[None]
    YTD([Date].[Calendar (YQMD)].CurrentMember)
    END SCOPE;
    END SCOPE;
    When I use my Calendar hierarchy and time calculation dimension as a background selection it takes forever. It never returns anything. A profiler trace shows that it's just pushing 1 and 21 events (cache data).
    If I create the following measure:
    CREATE
    MEMBER CURRENTCUBE.[Measures].[TestMTD] AS
    SUM(MTD([Date].[Calendar (YQMD)].CurrentMember), [Measures].[MyMeasure]),
    VISIBLE = 1 ;
    it works just fine but the whole point here is I want to avoid creating new measure for every time calculation.
    The measuregroup has been partitioned by month and I've set each partition slice to the corresponding month in the calendar hierarchy.
    Why doesn't my script perform - please advice :)
    Thanks.

    Hi Mortenbpost,
    According to your description, the issue was solved by change Aggregate() function to Sum() function, now you want to know why it behaves like that, right?
    In Aggregate function, if a numeric expression is not provided, this function aggregates each measure within the current query context by using the default aggregation operator that is specified for each measure. Here is a thread which discuss difference
    between AGGREGATE() and SUM()https://social.msdn.microsoft.com/Forums/sqlserver/en-US/ef4b2555-45f2-4871-9137-a12a637ce2f5/whats-the-difference-between-aggregate-and-sum?forum=sqlanalysisservices
    Besides, you can use SQL profiler to monitor what's the difference between using AGGREGATE() and using SUM().
    Regards,
    Charlie Liao
    TechNet Community Support

  • Transit time calculation through Route during Location Substitution

    Hi All,
          I have standard route determination set up in SD. I am picking up the route from Sales order and calculating the transit time in APO through condition technique TRAN.
         But when I do a location substitution , my transit time calculation is being done with the original route.
        EX: Original plant P1            Route: R1         Transit time: 24 hours
               Substituted Plant:   P2   Route : R2        Transit time :96 hours
              But my transit time in the substituted plant P2 is also 24 hours. Although I can see the new route R2 in the sales order item of the substituted item.
         Is there a user exit I can put?

    Hi ,
    Please try using Plant and Ship To combination, I saw it does not work with Route and shipping point.
    Thanks,
    Pavan Verma

  • Need help with date and time calculations please

    Hello there.. Im stuck, and im hoping someone can help..
    Working on a list to manage and track PTO.  User completes PTO request form,
    Fields
    Name
    Start Date (with time)
    End Date (with time)
    Total Number of Days/hours requested: (calculation)
    Full Day: (Yes/No)
    ok business need
    user has the ability to request a certain number of hours as opposed to a full day.
    After searching around on google. I found this calculation to help me figure out how many BUSINESS days being requested.
    =IF(ISERROR(DATEDIF([Start Date],[End Date],"d")),"",(DATEDIF([Start Date],[End Date],"d"))+1-INT(DATEDIF([Start Date],[End Date],"d")/7)*2-IF((WEEKDAY([End Date])-WEEKDAY([Start Date]))<0,2,0)-IF(OR(AND(WEEKDAY([End
    Date])=7,WEEKDAY([Start Date])=7),AND(WEEKDAY([End Date])=1,WEEKDAY([Start Date])=1)),1,0)-IF(AND(WEEKDAY([Start Date])=1,(WEEKDAY([End Date])-WEEKDAY([Start Date]))>0),1,0)-IF(AND(NOT(WEEKDAY([Start Date])=7),WEEKDAY([End Date])=7),1,0))
    This works great as long as its a [Full Day]="YES", displays results in column labeled Number of days
    now if [Full Day]="No", displays results in column labeled Number of Hours
    BUT this is my issue (well part of it) it calcuate the correct number of hours.. but puts a "1" in "Number of Days" why.. dates have not changed.. I think Its something with the above calculation but I could be way off.
    the end result is I need number of days to concat with number of hours 
    i.e 1 full day 4 hours  1.4
        0 full day 5 hours  0.5
        1 full day 0 hours  1.0
    so that the total can be deducted via workflow.. from the remaining balance in a tracker. (seperate list) 
    Any angels out there??

    Posnera-
    Try changing time zones and see if the travel itinerary times change.
    Fred

  • Basic and scheduling  dates & time calculation in process order creation

    Hi guru's,
    i have one requirement, i need to calculate and display the basic and scheduled dates & times based on the given input i.e material , plant , process order type , quantity , UOM and scheduling type ( for corresponding scheduling type user will provide either start date or finish date ) using RFC. can  u plz provide any function module for this purpose or logic for calculating the same  , as i am working on version 4.7ee .
    Awaiting for a quick response.
    Regards,
    Madan

    Dear Rohan,
    1.Check the length of break timings defined in the resource that is assigned in the phase.
    2.Check in OPUZ whether for the process order type and plant combination whether scheduling is to include the break time also
    (whether the check box for scheduling with breaks) is included.
    Check and revert back.
    Regards
    Mangalraj.S

  • Date and Time calculation in the Service Module

    Dear all,
    I have quite of a challenge here and i need serious guidance from your side.
    My client is in services industry and requires to calculate the date and time when the service call as to be closed. Not only it depends on the contract type the service is linked to but as well on the priority.
    The priority in Business One is unique, therefore we created a UDT (User Defined Table) to store the different 'response time' per contract/per priority. Example: a Platinum contract is always 24/7. But a gold contract priority 1 has to be closed in 240 minutes (4 workable hours) while a gold contract priority 2 has to be closed in 480 minutes (8 workable hours).
    I created 7 user defined fields on the Service Contract header that calculates the workable minutes per day. So if my coverage for Monday is from 8 AM to 4 PM, my UDF called DiffMon will show 480. For Tuesday, they start a bit later, and the coverage is 8:30 untill 16:00, therefore my UDF called DiffTue = 450.If the check box before the day in the Service Contract window is not ticked, then the UDF shows zero.
    I succeeded to calculate the expected closing time by using CASE WHEN statements as following, (all calculated in minutes):
         First, I need to check which day the Service call is created: A Monday or Thursday or... since my time coverage can change every day! I use SET DATEFIRST = 1 and compare today's date accordingly with my UDF DiffMon, DiffTue, etc.
         Then, When end of coverage time today Monday (4PM) minus the create time on the Service Call (1PM) is less then the time stored in my user defined table for that contract and that priority (i.e.480), then just add that to the create time and the create date (DateAdd(mi,...,...) ).
        When end of coverage time Monday (4PM) - Create time (1PM) + DiffTue(450) is bigger than 480, then I know I have enough time to solve my service call tomorrow Tuesday and I take the start time of Tuesday (8:30) + remaining time from yesterday (480-180 -> 180 = 3hours from 1PM to 4PM) and add that to the Create date + 1 so the end result will show Tuesday date and a time of 13:30
       Etc. untill I cover all possibilities based on which day is the service call created.
    NOW, I need to include the holiday table !!!!!!!!!!  And I can't foresee how the hell I am going to do that.
    The maximum coverage can go up to 60 hours, that means more than a working week! What happens if I have more than one bank holiday in that week period? What happens when my holiday table tells me that  date is a bank holiday but it is actually a Sunday and my contract is only running from Monday to Friday?
    Am I going straight to a big mess up?
    I will highly appreciate your comments,
    Regards,
    Frederic

    Hi,
    it is possible in query designer,
    u do the two things for getting the days between to dates
    1) in CMOD write the code for sy-datum create a customer exit variable in query as on caldate like eg zcedate
    when 'zcedate'.
    clear l_s_range.
    l_s_range-sign = 'i'.
    l_s_range-opt = 'eq'.
    l_s_range-low = sy-datum.
    append l_s_range to e_t_range.
    u write this code exit_saplrrso_001.
    it givs the sydatum
    2) then u create one more variable on zdate limit with replacement path
    then u go forto create the formula variable then it display ascreen there u select both customer exit variable and replacement path variable
    zcedate-replacementpathvariable
    it gives days i worked on this and succedded.
    like the same way fortime also u can do but here at the time of creating the customer exit varible u go for option as range here
    l_s_range-low = '20012009'
    l_s_range-high = '29012009'
    l_s_range-sign ='i'.
    l_s_range-opt = 'bt'.
    please try with the above one.
    Thanks & rEgards,
    k.sathish

  • [8i] Date/Time calculation problem...

    So, I am currently facing a situation where I need to calculate the total hours a workstation is in use for each day in a particular time period. I have a table with the log of each time each workstation is used. The problem is, a workstation can be used for any amount of time, starting on any day and ending on any day. This means that a particular entry in the log can span multiple days. I'm not sure how to split the difference between the end date/time of an entry and the start date/time of the entry over multiple days.
    Here's a sample table and some sample data for what I'm trying to do:
    -- Note: in reality, this table contains more columns
    CREATE TABLE     my_hrs
    (     record_id     NUMBER     NOT NULL
    ,     sdatetime     DATE     
    ,     edatetime     DATE     
    ,     workstation     VARCHAR2(4)
         CONSTRAINT my_hrs_pk PRIMARY KEY (record_id)
    -- Note: sdatetime, edatetime, and workstation CAN all be NULL, though I won't provide
    -- any sample data for these situations since I want to ignore them in my results
    -- Additionally, there are hundreds of workstations, but I'm only using 2 to simplify the sample data
    INSERT INTO     my_hrs
    VALUES (12345,TO_DATE('03/01/2010 08:00','mm/dd/yyyy HH24:MI'),TO_DATE('03/01/2010 13:35','mm/dd/yyyy HH24:MI'),'123A');
    INSERT INTO     my_hrs
    VALUES (13427,TO_DATE('03/01/2010 08:10','mm/dd/yyyy HH24:MI'),TO_DATE('03/01/2010 10:02','mm/dd/yyyy HH24:MI'),'321B');
    INSERT INTO     my_hrs
    VALUES (21543,TO_DATE('03/01/2010 14:07','mm/dd/yyyy HH24:MI'),TO_DATE('03/01/2010 16:30','mm/dd/yyyy HH24:MI'),'123A');
    INSERT INTO     my_hrs
    VALUES (22412,TO_DATE('03/01/2010 10:15','mm/dd/yyyy HH24:MI'),TO_DATE('03/01/2010 15:30','mm/dd/yyyy HH24:MI'),'321B');
    INSERT INTO     my_hrs
    VALUES (11976,TO_DATE('03/01/2010 17:00','mm/dd/yyyy HH24:MI'),TO_DATE('03/02/2010 02:30','mm/dd/yyyy HH24:MI'),'123A');
    INSERT INTO     my_hrs
    VALUES (34215,TO_DATE('03/01/2010 22:10','mm/dd/yyyy HH24:MI'),TO_DATE('03/02/2010 04:30','mm/dd/yyyy HH24:MI'),'321B');
    INSERT INTO     my_hrs
    VALUES (24789,TO_DATE('03/02/2010 13:00','mm/dd/yyyy HH24:MI'),TO_DATE('03/05/2010 02:30','mm/dd/yyyy HH24:MI'),'123A');
    INSERT INTO     my_hrs
    VALUES (31542,TO_DATE('03/02/2010 21:30','mm/dd/yyyy HH24:MI'),TO_DATE('03/04/2010 10:30','mm/dd/yyyy HH24:MI'),'321B');Based on my sample data above, these are the results I want to see:
    WORKSTATION     DATE          HRS_IN_USE
    123A          3/1/2010     14.96667
    321B          3/1/2010     8.95000
    123A          3/2/2010     13.50000
    321B          3/2/2010     7.00000
    123A          3/3/2010     24.00000
    321B          3/3/2010     24.00000
    123A          3/4/2010     24.00000
    321B          3/4/2010     10.50000
    123A          3/5/2010     2.50000
    321B          3/5/2010     0.00000Is this possible? (Please note, if the workstation was not used on a particular day, I want it to show 0 hours for that workstation for that day). Another thing to note is that I'm working with Oracle 8i.
    Thanks in advance for the help!

    Thanks, Frank, your explanation helped. My main problem was just that I couldn't picture what that line of the query was doing, even working from the inside out. I learn better through visual and hands-on methods, so to really understand, I had to look at the cross-join of a and h and go line by line. (In case there's anybody who looks at this post in the future and learns like I do, I've posted that data below).
    This definitely solves my problem!
    >
    By the way, this query is full of things that could be done better in later versions of Oracle. Generating table a is just one of them. Starting in Oracle 9, you can do a CONNECT BY query on dual to generate exacly how many rows you need. You never have to worry about an upper bound, and it's much faster than using ROWNUM. From time to time you might gently remind the people who decide these things that you're using a very old, unsupported version of Oracle, and that everyone could be more productive if you upgraded.
    >
    I could go on and on on this topic.... we have tried and continue to try to convince the powers that be to pay for the upgrades... if it were just Oracle that needed to be upgraded, we might actually have a chance at succeeding. As it is, ...ha.
    TABLE A (FROM SUB-QUERY)
    a_date          next_date
    3/1/2010     3/2/2010
    3/2/2010     3/3/2010
    3/3/2010     3/4/2010
    3/4/2010     3/5/2010
    3/5/2010     3/6/2010
    TABLE H (MY_HRS)          
    record_id     sdatetime     edatetime     workstation
    10000          2/28/2010 18:00     3/1/2010 5:30     123A
    12345          3/1/2010 8:00     3/1/2010 13:35     123A
    13427          3/1/2010 8:10     3/1/2010 10:02     321B
    21543          3/1/2010 14:07     3/1/2010 16:30     123A
    22412          3/1/2010 10:15     3/1/2010 15:30     321B
    11976          3/1/2010 17:00     3/2/2010 2:30     123A
    34215          3/1/2010 22:10     3/2/2010 4:30     321B
    24789          3/2/2010 13:00     3/5/2010 2:30     123A
    31542          3/2/2010 21:30     3/4/2010 10:30     321B
    CROSS-JOIN TABLE A WITH TABLE H                                             (and calculations done by the query below)     
    record_id     sdatetime     edatetime     workstation     a_date          next_date     LEAST (h.edatetime, a.next_date)     GREATEST (h.sdatetime, a.a_date)     GREATEST(TO_NUMBER(L-G),0)
    10000          2/28/2010 18:00     3/1/2010 5:30     123A          3/1/2010     3/2/2010     3/1/2010 5:30                    3/1/2010 0:00                    0.229166667
    10000          2/28/2010 18:00     3/1/2010 5:30     123A          3/2/2010     3/3/2010     3/1/2010 5:30                    3/2/2010 0:00                    0.00000
    10000          2/28/2010 18:00     3/1/2010 5:30     123A          3/3/2010     3/4/2010     3/1/2010 5:30                    3/3/2010 0:00                    0.00000
    10000          2/28/2010 18:00     3/1/2010 5:30     123A          3/4/2010     3/5/2010     3/1/2010 5:30                    3/4/2010 0:00                    0.00000
    10000          2/28/2010 18:00     3/1/2010 5:30     123A          3/5/2010     3/6/2010     3/1/2010 5:30                    3/5/2010 0:00                    0.00000
    12345          3/1/2010 8:00     3/1/2010 13:35     123A          3/1/2010     3/2/2010     3/1/2010 13:35                    3/1/2010 8:00                    0.23264
    12345          3/1/2010 8:00     3/1/2010 13:35     123A          3/2/2010     3/3/2010     3/1/2010 13:35                    3/2/2010 0:00                    0.00000
    12345          3/1/2010 8:00     3/1/2010 13:35     123A          3/3/2010     3/4/2010     3/1/2010 13:35                    3/3/2010 0:00                    0.00000
    12345          3/1/2010 8:00     3/1/2010 13:35     123A          3/4/2010     3/5/2010     3/1/2010 13:35                    3/4/2010 0:00                    0.00000
    12345          3/1/2010 8:00     3/1/2010 13:35     123A          3/5/2010     3/6/2010     3/1/2010 13:35                    3/5/2010 0:00                    0.00000
    13427          3/1/2010 8:10     3/1/2010 10:02     321B          3/1/2010     3/2/2010     3/1/2010 10:02                    3/1/2010 8:10                    0.07778
    13427          3/1/2010 8:10     3/1/2010 10:02     321B          3/2/2010     3/3/2010     3/1/2010 10:02                    3/2/2010 0:00                    0.00000
    13427          3/1/2010 8:10     3/1/2010 10:02     321B          3/3/2010     3/4/2010     3/1/2010 10:02                    3/3/2010 0:00                    0.00000
    13427          3/1/2010 8:10     3/1/2010 10:02     321B          3/4/2010     3/5/2010     3/1/2010 10:02                    3/4/2010 0:00                    0.00000
    13427          3/1/2010 8:10     3/1/2010 10:02     321B          3/5/2010     3/6/2010     3/1/2010 10:02                    3/5/2010 0:00                    0.00000
    21543          3/1/2010 14:07     3/1/2010 16:30     123A          3/1/2010     3/2/2010     3/1/2010 16:30                    3/1/2010 14:07                    0.09931
    21543          3/1/2010 14:07     3/1/2010 16:30     123A          3/2/2010     3/3/2010     3/1/2010 16:30                    3/2/2010 0:00                    0.00000
    21543          3/1/2010 14:07     3/1/2010 16:30     123A          3/3/2010     3/4/2010     3/1/2010 16:30                    3/3/2010 0:00                    0.00000
    21543          3/1/2010 14:07     3/1/2010 16:30     123A          3/4/2010     3/5/2010     3/1/2010 16:30                    3/4/2010 0:00                    0.00000
    21543          3/1/2010 14:07     3/1/2010 16:30     123A          3/5/2010     3/6/2010     3/1/2010 16:30                    3/5/2010 0:00                    0.00000
    22412          3/1/2010 10:15     3/1/2010 15:30     321B          3/1/2010     3/2/2010     3/1/2010 15:30                    3/1/2010 10:15                    0.21875
    22412          3/1/2010 10:15     3/1/2010 15:30     321B          3/2/2010     3/3/2010     3/1/2010 15:30                    3/2/2010 0:00                    0.00000
    22412          3/1/2010 10:15     3/1/2010 15:30     321B          3/3/2010     3/4/2010     3/1/2010 15:30                    3/3/2010 0:00                    0.00000
    22412          3/1/2010 10:15     3/1/2010 15:30     321B          3/4/2010     3/5/2010     3/1/2010 15:30                    3/4/2010 0:00                    0.00000
    22412          3/1/2010 10:15     3/1/2010 15:30     321B          3/5/2010     3/6/2010     3/1/2010 15:30                    3/5/2010 0:00                    0.00000
    11976          3/1/2010 17:00     3/2/2010 2:30     123A          3/1/2010     3/2/2010     3/2/2010 0:00                    3/1/2010 17:00                    0.29167
    11976          3/1/2010 17:00     3/2/2010 2:30     123A          3/2/2010     3/3/2010     3/2/2010 2:30                    3/2/2010 0:00                    0.10417
    11976          3/1/2010 17:00     3/2/2010 2:30     123A          3/3/2010     3/4/2010     3/2/2010 2:30                    3/3/2010 0:00                    0.00000
    11976          3/1/2010 17:00     3/2/2010 2:30     123A          3/4/2010     3/5/2010     3/2/2010 2:30                    3/4/2010 0:00                    0.00000
    11976          3/1/2010 17:00     3/2/2010 2:30     123A          3/5/2010     3/6/2010     3/2/2010 2:30                    3/5/2010 0:00                    0.00000
    34215          3/1/2010 22:10     3/2/2010 4:30     321B          3/1/2010     3/2/2010     3/2/2010 0:00                    3/1/2010 22:10                    0.07639
    34215          3/1/2010 22:10     3/2/2010 4:30     321B          3/2/2010     3/3/2010     3/2/2010 4:30                    3/2/2010 0:00                    0.18750
    34215          3/1/2010 22:10     3/2/2010 4:30     321B          3/3/2010     3/4/2010     3/2/2010 4:30                    3/3/2010 0:00                    0.00000
    34215          3/1/2010 22:10     3/2/2010 4:30     321B          3/4/2010     3/5/2010     3/2/2010 4:30                    3/4/2010 0:00                    0.00000
    34215          3/1/2010 22:10     3/2/2010 4:30     321B          3/5/2010     3/6/2010     3/2/2010 4:30                    3/5/2010 0:00                    0.00000
    24789          3/2/2010 13:00     3/5/2010 2:30     123A          3/1/2010     3/2/2010     3/2/2010 0:00                    3/2/2010 13:00                    0.00000
    24789          3/2/2010 13:00     3/5/2010 2:30     123A          3/2/2010     3/3/2010     3/3/2010 0:00                    3/2/2010 13:00                    0.45833
    24789          3/2/2010 13:00     3/5/2010 2:30     123A          3/3/2010     3/4/2010     3/4/2010 0:00                    3/3/2010 0:00                    1.00000
    24789          3/2/2010 13:00     3/5/2010 2:30     123A          3/4/2010     3/5/2010     3/5/2010 0:00                    3/4/2010 0:00                    1.00000
    24789          3/2/2010 13:00     3/5/2010 2:30     123A          3/5/2010     3/6/2010     3/5/2010 2:30                    3/5/2010 0:00                    0.10417
    31542          3/2/2010 21:30     3/4/2010 10:30     321B          3/1/2010     3/2/2010     3/2/2010 0:00                    3/2/2010 21:30                    0.00000
    31542          3/2/2010 21:30     3/4/2010 10:30     321B          3/2/2010     3/3/2010     3/3/2010 0:00                    3/2/2010 21:30                    0.10417
    31542          3/2/2010 21:30     3/4/2010 10:30     321B          3/3/2010     3/4/2010     3/4/2010 0:00                    3/3/2010 0:00                    1.00000
    31542          3/2/2010 21:30     3/4/2010 10:30     321B          3/4/2010     3/5/2010     3/4/2010 10:30                    3/4/2010 0:00                    0.43750
    31542          3/2/2010 21:30     3/4/2010 10:30     321B          3/5/2010     3/6/2010     3/4/2010 10:30                    3/5/2010 0:00                    0.00000
    (Then, the query sums up the last column in the "table" above, grouped by a_date and workstation).

  • Time - Calculating "Minutes Per MIle"

    For years, I have using an Excel spreadsheet to input my running times. I have a column for "miles", one for "Time" (hours, minutes, second using a "date" cell format) and a column entitled "Minutes per Mile." The formula for obtaining the Minutes per Mile is simple: Miles/Time or "=D15/D14" for example. But when I import my Excel file into Numbers, it cannot correctly populate the "Minutes per Mile" cell. A warning message states: "the Operator "/" expects a number, but cell D14 contains a date."
    How can I make this work in Numbers?

    Thank you, Terry but it still doesn't work. I had to modify the formula you gave me as follows:
    =C15/(TIMEVALUE(D15)*1440)
    C15 is the actual number of miles, for example 13.4 (this cell is formatted as a number); D15 is total time of the run (hopefully you refer to this as the Minutes column), 2:37:57 AM (this cell is formated as Time using the cell inspector as you suggested); and E15 is the minutes per mile (this is also formatted as Time). When I insert the formula into cell E15, I receive an answer of 0.09. I don't know what that means; the time should have been 11:47 meaning 11 minutes and 47 seconds per mile. Am I formatting the cells incorrectly or is it the formula? I tried opening the Excel file in a program called NeoOffice and the calculation worked just fine. This is driving me crazy. Can you give me some more assistance? Finally, you are talking about "Numbers" not "Pages", right!

  • Numbers: Cell time calculation not adding the correct time

    Greetings,
    First, thank you in advance for your assistance. I have searched the board and where there are many great formulas, I have not found the answer to this challenge.
    Cell A1 has a time for example 5:45 PM
    Cell C1 has an amount of minutes for example 40
    Cell B1 should be adding 40 minutes to 5:45 PM for result of 6:25 PM
    Cell A2 picks up the value of Cell B1 as its starting value so that it can calculate the same formula for the next line.
    This document is a schedule so that it adjusts the times based on the amount of minutes a segment is. I can post an excel file if that will assist, the excel formula for this in the B cell is A1+TIME(0,C1,0)
    Again thank you in advance for any assistance in solving this challenge.
    John

    =TIME(HOUR(A),MINUTE(A)+C,0)
    • Every time I may use them, I uses the "short references", those with no row num embedded.
    • The TIME function requires three parameters,
    a number of hours,
    a number of minutes
    a number of seconds
    but the formula parser is fair enough to understand that, when the given number of minutes is greater than 59, it means some hours + some minutes.
    And of course, mutatis mutandis, it's the same for the number of seconds.
    This is why, when I want to display with the current format hh:mm:ss a decimal time value as those resulting of calculations, I don't spent time to isolate the number of hours, the number of minutes, the number of seconds. I just calculate the total number of seconds.
    if cell B2 contains 0.1234490740741
    I type =TIME(0,0,B24*6060) in cell C2
    Then, applying the yy:mm:ss format I get 02:57:46
    inserting =TIMEVALUE(C) in D2, I get 0.1234490740741
    I know that this behavior is not described in the Help.
    I don't feel that it's a sin.
    It's for passing this kind of details that the forum exists.
    I feel perfectly odd questions whose response is available in the Help but it's always a pleasure to help users to discover features which are only available "between the lines".
    Yvan KOENIG (from FRANCE vendredi 4 juillet 2008 14:48:21)

  • Time Calculations in a Table

    I am creating a new timesheet Which uses a table with a add time/remove time buttons.
    The basic table has a Time In row and a Time Out row. In the footer row Itotal each day. That is no problem as i am using the same script I use in other forms.
    The problem occurs is when you click the Add Time button and now another instance of the Time In and Time Out rows are added.
    How do I now calculate that time and add the 2 together. I can add up to an additional 2 instances. Below is my script for just calculating the basic time for Sunday.
    Thanks,
    Craig
    var vTime1 = Times.TimeIn.in1Sun1.rawValue;
      if (vTime1.length == 4 && vTime2.length == 4) {
    var vTime1Minutes = parseInt(vTime1.substring(0, 1))*600 + parseInt(vTime1.substring(1, 2))*60 + parseInt(vTime1.substring(2, 4));
    var  vTime2Minutes = parseInt(vTime2.substring(0, 1))*600 + parseInt(vTime2.substring(1, 2))*60 + parseInt(vTime2.substring(2, 4));
    this.rawValue = (vTime2Minutes - vTime1Minutes)/60;
    var  vTime2= Times.TimeIn.out1Sun1.rawValue;

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Office, I'll move your question to the Power Pivot forum
    http://social.technet.microsoft.com/Forums/sqlserver/en-US/home?forum=sqlkjpowerpivotforexcel
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support

Maybe you are looking for