Components of the View Definition | CREATE RECURSIVE VIEW | Teradata Vantage - 17.10 - Seed Statement Component of the View Definition - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1184-171K
Language
English (United States)

A seed statement is the non-recursive statement portion of a recursive view definition. Its purpose is to provide the initial row set to be used to build a recursive relation later in the process. To produce the desired recursion, the seed statement must produce 1 or more rows; otherwise, running the recursive query produces an empty result set.

By definition, there are no references to recursive relations anywhere in the seed statement. Taking the example developed in The Concept of Recursion, the code highlighted in bold typeface is the seed statement for the definition.

CREATE RECURSIVE VIEW reachable_from (source,destination,depth) AS (
  SELECT root.source, root.destination, 0 AS depth 
  FROM flights AS root 
  WHERE root.source ='Paris'
UNION ALL
  SELECT in1.source, out1.destination, in1.depth + 1
  FROM reachable_from in1, flights AS out1
  WHERE in1.destination = out1.source
  AND   in1.depth <= 100);

As you can see, there are no references to recursive relations within the seed query.