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 |
If MaxDecimal in DBSControl is…
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 as it is for the COUNT aggregate function and, therefore, cannot be used to avoid numeric overflow errors that might 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 according to the following rules: If MaxDecimal in DBSControl is 0 or 15 and
If MaxDecimal in DBSControl is 18 and
If MaxDecimal in DBSControl is 38 and n = any value, the p = 38. |
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 |