Input and Output - Analytics Database - Teradata Vantage

SQL Date and Time Functions and Expressions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-10-30
dita:mapPath
cpk1628111786971.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
pxz1544241488545
lifecycle
latest
Product Category
Teradata Vantage™
TD_SEQUENCED_SUM is a table function that takes three arguments. The arguments passed to the function are the specified columns in a subtable derived from using the WITH Request Modifier as follows:
  • The first argument is one or more grouping columns, not including the Period column. You must specify this argument as a dynamic UDT, where each column is an attribute of the UDT. For details, see the information about NEW VARIANT_TYPE in Teradata Vantage™ - Data Types and Literals, B035-1143.
  • The second argument is a numeric column on which SUM() is requested. All numeric data types are supported. You must specify this argument as a dynamic UDT where the column is an attribute of the UDT.
  • The third argument is the Period column where you want to find the Period values that overlap or meet.
Input to the table function must be columns that are hash-redistributed on the grouping columns and sorted by the grouping columns and the Period values as follows:
  • You must specify a LOCAL ORDER BY clause that includes all of the grouping columns and the Period column in the same order that was specified in the input arguments. The sort order must be ascending.
  • You must include a HASH BY clause with at least one of the grouping columns. The HASH BY clause cannot include the Period column or any columns that are not part of the grouping columns.
You must invoke the function with a RETURNS clause that specifies the output columns as follows:
  • The output columns must include all of the grouping columns with the same data type and in the same order as the input columns.
  • You must include a numeric output column to contain the sum result value. The data type of this column should be the same data type as the corresponding input column. To prevent a possible overflow error, you can use the CAST function to convert the data type of the input column to a larger numeric data type.
  • A Period column with the same Period data type as the input Period column.