I wrote this query to calculate the hours/minutes/seconds between 2 dates.
When I run the query in Oracle using TOAD, all is well, I get what I expect
to see.
When I take the query and use it in the .Net world, my results are
completely different, all the number are negative, rather then positive
numbers and they bear no relation to the values that were displayed when I
run the query in Toad.
Here is a sample of the query...
SELECT ott.YEAR, ott.time_seq,
orc.PDM_CUTOFF_PERIOD,TRUNC(86400*(orc.PDM_CUTOFF_PERIOD-SYSDATE))- 60*
(TRUNC((86400*(orc.PDM_CUTOFF_PERIOD-SYSDATE))/60)) seconds
FROM ops_time_tbl ott, ops_report_Calendar orc WHERE ott.time_type = 'M'
AND ott.time_id = orc.TIME_ID
orc.PDM_CUTOFF_PERIOD is a date such as 6/24/2004.
The above, is just a calculation for seconds, but it caculates Weeks,
Hours, Minutes and seconds. In TOAD they show up something like 4 weeks,
34 days, 8 hours, 24 minutes and 16 seconds.
In the .Net datareader when I read them as dt.GetInt32(3) -- for one field,
such as weeks, it shows -9 and Toad show +4.
Should I not be reading them as Integers? I tried reading it as DateTime,
but that failed.
What might I be doing incorrectly>
|