Archives of the TeradataForum
Message Posted: Wed, 18 May 2005 @ 14:08:37 GMT
Subj: | | Re: Calculate TIMESTAMP difference |
|
From: | | Maxwell, Donald |
When you subtract two timestamps, you must declare the resulting INTERVAL datatype, ie.
SELECT ctime - c DAY(4) TO SECOND
Therefore, your where clause should be:
WHERE (INTERVAL '30' SECOND < ctime - c DAY(4) TO SECOND )
Alternatively, you could say:
WHERE c < CURRENT_TIMESTAMP - INTERVAL '30' SECOND
This last alternative is probably your best option because it will never overflow, and you don't need the declared variable.
Donald Maxwell
|