-342   THE COMMON TABLE EXPRESSION name MUST NOT USE SELECT DISTINCT AND MUST USE UNION ALL BECAUSE IT IS RECURSIVE

Explanation

There are two possible explanations:
  • A fullselect within the common table expression name cannot start with SELECT DISTINCT because the common table expression is recursive.
  • A fullselect within the common table expression name specified UNION instead of UNION ALL as required for recursive common table expressions.

System action

The statement cannot be processed.

Programmer response

Remove the keyword DISTINCT from the common table expression, add the keyword ALL following UNION, or remove the recursive reference within the common table expression.

SQLSTATE

42925