The result data type and format for window aggregate functions are as follows.
Function | Result Type | Format |
---|---|---|
AVG(x) where x is a character type |
FLOAT | Default format for FLOAT |
AVG(x) where x is a numeric, DATE, or INTERVAL type |
FLOAT | Same format as operand x |
where x is a character type |
FLOAT | Default format for FLOAT |
where x is one of the following types:
|
Same data type as operand x. | Default format for the data type of operand x |
REGR_AVGX(y,x) REGR_AVGY(y, x) where x is a UDT |
Default format for the data type to which the UDT is implicitly cast. | |
COUNT(x) COUNT(*) REGR_COUNT(x ,y) where the transaction mode is ANSI |
ANSI transaction mode uses DECIMAL because tables frequently have a cardinality exceeding the range of INTEGER. |
|
COUNT(x) COUNT(*) REGR_COUNT(x,y) where the transaction mode is Teradata |
INTEGER Teradata transaction mode uses INTEGER to avoid regression problems. You can cast the final result of a COUNT window aggregate function. However, the cast is not used as part of the window function computation. Therefore, the cast cannot be used to avoid numeric overflow errors that may occur during the computation.
|
Default format for INTEGER |
MAX(x), MIN(x) | Same data type as operand x. | Same format as operand x |
SUM(x) where x is a character type |
Same as operand x. | Default format for FLOAT |
SUM(x) where x is a DECIMAL(n,m) type |
DECIMAL(p,m), where p is determined by a system setting. | Default format for DECIMAL |
SUM(x) where x is any numeric type other than DECIMAL |
Same as operand x. | Default format for the data type of the operand |