Results 1 to 4 of 4

Thread: [RESOLVED] Query Help

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    482

    Resolved [RESOLVED] Query Help

    I am working on a program to read in Timestamps from an Oracle DB and check how long transactions are taking by subtracting the Timestamps.

    The DB is setup so that when a transaction starts an entry is made into the DB with a MsgID, Timestamp, "START" then when it completes a new record is made MsgID, Timestamp, "END". Thanks to RhinoBull I have figured out how to read the Oracle Timestamps into VB but it seems no Microsoft products can perform date functions on these due to the format containing sub-seconds: 14-JUL-10 03.01.48.483624 AM.

    I know I could break those down into various pieces then compare each piece and put the result back together but that is a real PITA. Is there a way to query the DB to return both Timestamps AND the difference between them as part of a SINGLE record?

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Query Help

    this is a specific oracle database question and would be better in the database forum
    i would believe that oracle should be able to return the value you want, to some level of precision
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3
    Addicted Member
    Join Date
    Jul 2010
    Posts
    158

    Re: Query Help

    Hi,

    Yes... Try This :

    SELECT Date1, Date2, ((Date1 – Date2)*24*60*60) as MySeconds From MyTable

    Regards
    Veena

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    482

    Re: Query Help

    I ended up just pulling the sub-second portion of the Time stamp out and using the DateDiff to get the seconds, then subtracting the sub-second and then adding the answers together. A bit more work but works perfectly. Thanks for the answers guys, marking as Resolved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width