Rules and Restrictions for the TOP n Operator - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
You cannot specify the TOP n operator in any of these SQL statements or statement components:
  • Correlated subquery
  • Subquery in a search condition
  • CREATE JOIN INDEX
  • Seed statement or recursive statement in a CREATE RECURSIVE VIEW statement or WITH RECURSIVE statement modifier
  • Subselects of set operations.
You cannot specify these options in a SELECT statement that specifies the TOP n operator:
  • DISTINCT option
  • QUALIFY clause
  • SAMPLE clause
  • WITH clause

    This restriction refers to the WITH clause you can specify for summary lines and breaks. See WITH Clause. The nonrecursive WITH statement modifier that can precede the SELECT keyword can be included in statements that also specify the TOP n operator. See WITH Modifier.

  • ORDER BY clause where the sort expression is an ordered analytical function.

You cannot specify the n value of a TOP n specification as a USING parameter for iterated array processing. For an example, see Example: Non-Support for Iterated Requests with TOP n.