I am tring to excute the following SQL statements through the Iseries Navigator. But i come up with an error saying recursion is not allowed in common table expression.
Kindly help
WITH TEMP ( SUPV_ID,EMPID, FIRSTNAME) AS
(
SELECT TV.SUPV_ID,TV.EMPID, TV.FIRSTNAME
FROM TRNWORK.TRAINEE_MASTER_VIEW TV
WHERE TV.SUPV_ID = '1777'
UNION ALL
SELECT T.SUPV_ID , T.EMPID, T.FIRSTNAME
FROM TRNWORK.TRAINEE_MASTER_VIEW C , TEMP P
WHERE P.EMPID = C.SUPV_ID
)
SELECT EMPID, SUPV_ID, FIRSTNAME FROM TEMP;
Kindly help
WITH TEMP ( SUPV_ID,EMPID, FIRSTNAME) AS
(
SELECT TV.SUPV_ID,TV.EMPID, TV.FIRSTNAME
FROM TRNWORK.TRAINEE_MASTER_VIEW TV
WHERE TV.SUPV_ID = '1777'
UNION ALL
SELECT T.SUPV_ID , T.EMPID, T.FIRSTNAME
FROM TRNWORK.TRAINEE_MASTER_VIEW C , TEMP P
WHERE P.EMPID = C.SUPV_ID
)
SELECT EMPID, SUPV_ID, FIRSTNAME FROM TEMP;