-346 AN INVALID REFERENCE TO COMMON TABLE EXPRESSION name OCCURS IN THE FIRST FULLSELECT, AS A SECOND OCCURRENCE IN THE SAME FROM CLAUSE, OR IN THE FROM CLAUSE OF A SUBQUERY
Explanation
The common table expression name includes an invalid reference
to itself as described by one of the following:
- A recursive reference in the first fullselect before the UNION ALL set operator. The first fullselect must be an initialization and cannot include a recursive reference.
- More than one reference to the same common table expression in the same FROM clause. Such references are not permitted in recursive common table expression.
- A recursive reference in the FROM clause of a subquery. A recursion cycle cannot be defined using a subquery.
System action
The statement cannot be processed.
Programmer response
Change one of the following:
- the fullselect prior to the union operator so that it does not include a recursive reference.
- the FROM clause containing more than one reference to the same common table expression to just one reference .
- the FROM clause of the subquery so that it does not reference the common table expression.
SQLSTATE
42836