|
-
Jul 16th, 2010, 02:00 PM
#1
Thread Starter
Hyperactive Member
[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?
-
Jul 16th, 2010, 04:54 PM
#2
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
-
Jul 17th, 2010, 12:12 AM
#3
Addicted Member
Re: Query Help
Hi,
Yes... Try This :
SELECT Date1, Date2, ((Date1 – Date2)*24*60*60) as MySeconds From MyTable
Regards
Veena
-
Jul 17th, 2010, 05:13 PM
#4
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|