15.00 - Seed Statement Component of the View Definition - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

prodname
Teradata Database
vrm_release
15.00
category
Programming Reference
featnum
B035-1184-015K

Seed Statement Component of the View Definition

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” on page 483, 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.