Lead - Teradata Warehouse Miner

Teradata Warehouse Miner User Guide - Volume 2ADS Generation

Product
Teradata Warehouse Miner
Release Number
5.4.4
Published
July 2017
Language
English (United States)
Last Update
2018-05-03
dita:mapPath
fcf1492702067123.ditamap
dita:ditavalPath
ft:empty
dita:id
B035-2301
Product Category
Software

The LEAD function evaluates an expression at a constant offset from the current row. The offset is expressed as the count of rows ahead of the current row in the sort order of the partition. When dragging a LEAD function into a Variable, the following tree element is created.

Variable Creation > Input > Variables: SQL Elements pane - Ordered Analytical Functions > Lead

Teradata Database

The partitioning and sorting syntax is the same as that of other Window functions (there is an OVER clause with PARTITION BY and ORDER BY expressions) . In this case , there are also three additional arguments: a required SQL expression, an optional offset (with a default of one), and a default value (with a default of Null). An optional RESET WHEN expression may also be specified as the last item in the Partition Columns folder. A description of this element is given separately in this section.

Row options are not available with the Lead function.

Aster Database

The partitioning and sorting syntax is the same as that of other window functions (there is an OVER clause with PARTITION BY and ORDER BY expressions). In this case ,the ORDER BY clause is required and three additional arguments are required: an SQL expression, an offset, and a default value. As with numbering Window functions, if two or more rows sort as equals (tie) in the sort order, the function arbitrarily sorts the sorted-as-equal rows.