Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - SQL Usage » Queries and data modification » Common table expressions


Recursive common table expressions

Common table expressions are recursive when they are executed repeatedly, with each execution returning additional rows until the complete result set is retrieved. You can make a common table expression recursive by inserting the RECURSIVE keyword immediately following WITH in the WITH clause. A single WITH clause may contain multiple recursive expressions that can be both recursive and non-recursive.

Recursion provides an easier way of traversing tables that represent tree or tree-like data structures. Without using recursive expressions, the only way to traverse such a structure in a single statement is to join the table to itself once for each possible level.

 Restrictions on recursive common table expressions
 See also

Data type declarations in recursive common table expressions
Multiple recursive common table expressions