473,399 Members | 3,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Recursion not allowed for common table expressions error

I am tring to execute the following SQL statements through the Iseries
Navigator for DB2/V8.2, But i come up with an error saying recursion is
not allowed in common table expression. This is a example i picked up
from SQL cook book. I am not sure where i am wrong.
Any help is appreciated
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;

================================================== ===
---Error------------

SQL State: 42836
Vendor Code: -346
Message: [SQL0346] Recursion not allowed for common table expressions.
Cause . . . . . : The common table expression specified is not valid.
The subselect for table TEMP refers to itself. Recursive common table
expressions are not allowed. Recovery . . . : Change the common table
expressions to refer to a table that exists or a common table
expression that has already been defined. Try the request again.

Nov 12 '05 #1
1 4957
Endif wrote:
I am tring to execute the following SQL statements through the Iseries
Navigator for DB2/V8.2, But i come up with an error saying recursion is
not allowed in common table expression. This is a example i picked up
from SQL cook book. I am not sure where i am wrong.
Any help is appreciated
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;

================================================== ===
---Error------------

SQL State: 42836
Vendor Code: -346
Message: [SQL0346] Recursion not allowed for common table expressions.
Cause . . . . . : The common table expression specified is not valid.
The subselect for table TEMP refers to itself. Recursive common table
expressions are not allowed. Recovery . . . : Change the common table
expressions to refer to a table that exists or a common table
expression that has already been defined. Try the request again.


Recursive common table expressions are not currently supported by DB2
UDB for iSeries - it is a known requirement.

Fyi: Since DB2 on iSeries is not a separate product, its version is the
same as the operating system. DB2/V8.2 is a release of DB2 UDB for LUW.
The latest release of i5/OS (formerly OS/400) is V5R3.

http://www.ibm.com/servers/eserver/iseries/db2/

--
Karl Hanson
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Georgy Pruss | last post by:
Sometimes I get this error. E.g. >>> sum = lambda n: n<=1 or n+sum(n-1) # just to illustrate the error >>> sum(999) 499500 >>> sum(1000) ............ RuntimeError: maximum recursion depth...
5
by: Peri | last post by:
I'm trying to create Python parser/interpreter using ANTLR. Reading grammar from language refference I found: or_expr::= xor_expr | or_expr "|" xor_expr For me it looks like infinite recursion....
12
by: Mikito Harakiri | last post by:
I wonder if WITH RECURSIVE MaryAncestor(anc,desc) AS ( (SELECT parent as anc, child as desc FROM ParentOf WHERE desc = "Mary") UNION (SELECT A1.anc, A2.desc FROM MaryAncestor A1, MaryAncestor...
1
by: Endif | last post by:
I am tring to execute the following SQL statements through the Iseries Navigator for DB2/V8.2, But i come up with an error saying recursion is not allowed in common table expression. This is a...
3
by: Ankit Aneja | last post by:
This is my problem. I am using Visual 2003, .Net framework 1.1 and the Application Block I configured the DAAB using the Enterprise Library Configuration now this is the error which is coming ...
18
by: MTD | last post by:
Hello all, I've been messing about for fun creating a trial division factorizing function and I'm naturally interested in optimising it as much as possible. I've been told that iteration in...
3
by: greek | last post by:
Hi! I hav to generate fibonaaci series using recursion: 0,1,1,2,3,5,8,18,21... whr fibonacci(0)=0 fibonacci(1)=1 fibonacci(n)=fibonacci(n-1)+fibonacci(n-2) ive witten the code but having 2...
13
by: robert | last post by:
My code does recursion loops through a couple of functions. Due to problematic I/O input this leads sometimes to "endless" recursions and after expensive I/O to the Python recursion exception. What...
35
by: Muzammil | last post by:
int harmonic(int n) { if (n=1) { return 1; } else { return harmonic(n-1)+1/n; } } can any help me ??
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.