Hi,
ANSI SQL defines
timestamp - timestamp == an interval.
The problem it doesn't define what the default UNIT for interval. interval units can be...
year ( number of years )
month ( number of months )
year to month ( number of years + remaninder months )
day ( number of days Maximum 9999 days ( 27 years ))
day to hour ( number of days + remainder hours )
day to minute ( number of days + remaninder hour:minutes )
day to second ( number of days + remainder hour:minute:second.sec)
hour ( number of hours maximum 9999 hours ( 13 months ))
hour to minute ( number of hours + remainder minutes )
hour to second ( number of hours + remainder minute:seconds.sec)
minute ( number of minutes 9999 minutes ( 1 week ))
minute to second ( number of minutes + remainder seconds )
second ( number of seconds )
Note that all these are singular and not plural ( hour not hours ). Again this is ANSI SQL requirement.
therefore your SQL should be more like....
sel column1 - column2 minute(4)
from blort;
(4) asks it to use 4 digits format 9999. the Maxium precision is 6 for seconds ( which is actually the decimal portion of seconds ) and the maximum number of digits for the others is 4 ( or 9999 ).
Again that is ANSI.
9999 minutes is about 7 days.
If you exceed the maximum value you will get a
*** Failure 7453 Interval field overflow.
you might want to use
sel column1 - column2 day(4) to Second
from blort;
which will allow 9999 days or roughly 27 years. the answer will look like...
135 16:49:20.340000
if you want to combine this with EXTRACT....
sel EXTRACT ( Minute from ( column1 - column2 day(4) to Second ))
from blort;
this would return from the above example
49
But 49 minutes isn't eqivelent to 195409 minutes
(((( 135 * 24 ) + 16 ) * 60 ) + 49)
days hours minutes
So which value were you trying to obtain?
If you would like more information on interval please see....
click on
SQL reference
then select
Teradata RDBMS SQL Reference - Volume 3 Data Types and Literals
chapter 4 DateTime and Interval Data Types
or
Teradata RDBMS SQL Reference - Volume 5 Functions and Operators
Chapter 5 DateTime and Interval Functions and Expressions