|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Subtract Timestamp interval |
« View previous topic :: View next topic » |
Author |
Message
|
Lo |
Posted: Sat Nov 12, 2005 11:17 am Post subject: Subtract Timestamp interval |
|
|
Novice
Joined: 14 Feb 2005 Posts: 21
|
Folks,
Can anyone tell me what is wrong in this statement , i cannot get an interval into Processtime
I can see tsTmp1 and tsTmp2 in the debug with valid timestamp values. Yet when i subtract , ProcessTime is not set to any thing.
One more thing the IF test always returns a false, shouldnt this throw an exception is ProcessTime is NULL?
DECLARE tsTmp1 TIMESTAMP;
DECLARE tsTmp2 TIMESTAMP;
DECLARE ProcessTime INTERVAL;
DECLARE Seconds INTERVAL;
SET tsTmp1 = CURRENT_TIMESTAMP;
SET tsTmp2 = CAST(Environment.Variables.Timer.Start AS TIMESTAMP);
SET ProcessTime = (tsTmp1 - tsTmp2) SECOND;
SET Seconds = INTERVAL '10' SECOND;
IF( ProcessTime > Seconds ) THEN
SET EXPIRED = TRUE;
END IF;
Thanks
|
|
Back to top |
|
 |
JT |
Posted: Mon Nov 14, 2005 8:51 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Did you forget something ?
Quote: |
SET ProcessTime = INTERVAL (tsTmp1 - tsTmp2) SECOND; |
Quote: |
One more thing the IF test always returns a false, shouldnt this throw an exception is ProcessTime is NULL? |
No, when comparing values, if any of the operands is NULL, then the result is UNKNOWN, and an UNKNOWN condition, on a comparision, is treated the same as FALSE. |
|
Back to top |
|
 |
EddieA |
Posted: Mon Nov 14, 2005 9:29 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
JT wrote: |
Did you forget something ?
Quote: |
SET ProcessTime = INTERVAL (tsTmp1 - tsTmp2) SECOND; |
|
Not according to the manual.
Quote: |
Declare PutTime INTERVAL;
SET PutTime = (CURRENT_GMTTIME - InputRoot.MQMD.PutTime) MINUTE TO SECOND; |
And
Quote: |
Subtracting a (GMT)TIME value from a (GMT)TIME value, a DATE value from a DATE value, or a (GMT)TIMESTAMP value from a (GMT)TIMESTAMP value, results in an INTERVAL value representing the time interval between the two operands. |
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
Lo |
Posted: Tue Nov 15, 2005 10:34 pm Post subject: |
|
|
Novice
Joined: 14 Feb 2005 Posts: 21
|
Actually the interval did exist but my debugger was not showing it.
I just converted the Interval to an Integer.
SET SecondsInt = CAST(Seconds AS INTEGER);
SecondsInt gave me the proper value. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|